Ask Your Question

Basic macro for xml export with attributes

asked 2018-01-30 22:38:56 +0200

daniel1 gravatar image


to export pages of a writer document into an xml document i use the code in this answer.

Now i want the page number as an attribute, like this:

 <page number=1>
 Text of page 1
 <page number=2>
 Text of page 2

How do I do this?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-01-31 07:13:01 +0200

librebel gravatar image

Hello again @daniel1,

This can be done by adding just 1 line of code inside the method Writer_Export_Pages_To_XML().

The line to add is: oPage.setAttribute( "number", i)

This line should be inserted directly after the line: oPage = oXML.createElement( "page" )

HTH, lib

edit flag offensive delete link more


Thank you, that works!

daniel1 gravatar imagedaniel1 ( 2018-01-31 10:18:05 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-01-30 22:38:56 +0200

Seen: 46 times

Last updated: Jan 31 '18