[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: Problems with User-defined variables in KWord
From:       Jaroslaw Staniek <js () iidea ! pl>
Date:       2006-03-16 23:40:32
Message-ID: 4419F770.8040907 () iidea ! pl
[Download RAW message or body]

Sebastian Sauer said the following, On 2006-03-16 23:55:

> Seems to be a more generic problem. E.g. at
> 
>    <text:p text:style-name="P2" >
>         Line1
>         Line2
>    </text:p>
> 
> KWord introduces a linebreak between Line1 and Line2 while oo.org adds a 
> whitespace between them.
> 
Bah! Thanks for this note.

FYI: I am using QDomDocument::toString() to produce content.xml so unlike 
oo.org's XML, my XML is indented and contains \n. But KWord does the same as me...

1. OTOH In this example, two variables

[Name] [Surname]

using text:user-field-get tag _should_ be rendered as a single line/paragraph
but KWord magically creates two lines ...

[Name]
[Surname]

...for this XML:
    <text:p text:style-name="P2" >
     <text:user-field-get text:name="name2" >Name</text:user-field-get>
     <text:user-field-get text:name="surname2" >Surname</text:user-field-get>
    </text:p>


2. Notes:
As there is one space inserted between [Name] and [Surname] in the document, 
second text:user-field-get tag comes after at least one whitespace. For 
oo.org-generated XML, the whitespace is jsut one space. For KWord it's \n plus 
full indentation (4 spaces in our case).

I can see Sebastion already provided a patch eating a \n.

I also tested how the oo.org's XML looks like when two spaces are inserted in 
between (i.e. [Name] [Surname]) and <text:s/> appears to be used once, as the 
secons space is a real space:

<text:user-field-get text:name="name2" >Name
</text:user-field-get> <text:s/><text:user-field-get text:name= [..]
                       ^
                       |notice this space + <text:s/>

OK. David, could you tell me, is this a valid behaviour?
For me, <text:s/> should be used. See 3. for explanation.

3. Now after considering the example with two non-breaking spaces,
   I can see a PROBLEM... (please correct me):

QDomDocument::toString() will indent and waste information about number of 
spaces used between tags (in general, but in our case between variables)

It will just indent as follows:

   <text:user-field-get text:name="name2" >Name</text:user-field-get>
   <text:s/>
   <text:user-field-get text:name= [..]

So we have a whitespace before and after <text:s/>, while in the example 2., 
for oo.org's XML, we have just one space plus <text:s/>.

There's probably a workaround for this and that's my main question now.

-- 
regards / pozdrawiam,
  Jaroslaw Staniek / OpenOffice Polska

Sponsored by OpenOffice Polska to work on
* Kexi & KOffice: http://www.kexi-project.org | http://koffice.org/kexi
* KDE3 & KDE4 Libraries For Developing MS Windows Applications:
                   http://www.kdelibs.com/wiki
See also:
* Kexi For MS Windows: http://kexi.pl/wiki/index.php/Kexi_for_MS_Windows
* Kexi Support:        http://www.kexi-project.org/support.html
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic