https://bugs.documentfoundation.org/show_bug.cgi?id=163748

--- Comment #7 from Mike Kaganski <[email protected]> ---
Just to check things. In your code (and in mine), there is a piece checking if
there is an existing page style with this name. If there is not, then the new
style is created (meaning: inserted into the document with the name); but if it
already is, then the work continues without actually inserting the style, and
the changes are simply in a nameless temporary, which will be discarded.

So - can you make it hard-fail when there is such a style? Or alternatively:
change the code like this (Basic) code:

 xFamilies = mMyDocument.getStyleFamilies()
 xFamily = xFamilies.getByName("PageStyles")
 if (xFamily.hasByName(MY_PAGE_STYLE_NAME)) then
  xPageStyle = xFamily.getByName(MY_PAGE_STYLE_NAME)
 else
  xPageStyle = mMyDocument.createInstance("com.sun.star.style.PageStyle")
  xFamily.insertByName(MY_PAGE_STYLE_NAME, xPageStyle)
 endif

The suspicion is, that *maybe* you have accidentally made a *default template*
with the partially created style; and now, when you execute your code, the new
document has that partially defined style, and indeed, all the changes in your
code are done with a discarded temporary.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to