How to fix import of headings in DOC/DOCX (text:h instead of text:p)?

Friedrich W. H. Kossebau kossebau at kde.org
Mon Jul 14 22:42:05 BST 2014


Hi Lassi,

Am Sonntag, 13. Juli 2014, 19:36:27 schrieb Lassi Nieminen:
> Docx the magical file is DocxXmlDocumentReader.cpp  (don't have code atm.,
> so method names may be slightly different)
> 
> For style the structure seems to be:
> 
> <w:pPr><w:outlineLvl w:val="0"/></w:pPr>
> 
> In read_pPr you need to add a call to new method
> 
> read_outlineLvl where you can read the potential value
> 
> In the actual document in w:pPr you may find the outlineLvl or you may find
> that it references some other style which has outlineLvl, here Heading1
> 
> <w:p>
> <w:pPr>
> <w:pStyle w:val="Heading1"/>
> </w:pPr>
> <w:r>
> <w:t>Hi</w:t>
> </w:r>
> </w:p>
> 
> This means that in read_pStyle you should also check the whether the
> referenced style has outlineLevel
> 
> Now in read_p method replace someWriter->startElement("text:p") with
> someWriter("text:h") if the used paragraph style or the style it references
> has outlineLvl set
> 
> Hopefully this approach works.

Thanks a lot for the pointers! Following them now and discovering a land full 
of magic... 8) Hopefully I can bring any headings back to their levels and 
then will find my way out again of here :) 
Hopefully my ball of wool is long enough...

Cheers
Friedrich




More information about the calligra-devel mailing list