Arthur wrote:
>>>>> Adding a new CharacterStyle to a text document (with Java via
>>>>> xFamily.insertByName()) succeeds and gives the appropriate entry in the
>>>>> "Styles and Formatting" window. But applying it to any text yields a
>>>>> document which can't be saved. Trying to save it gives a "Error in
>>>>> writing sub-document content.xml" message. Doing the very same with a
>>>>> ParagraphStyle doesn't result in that error message and the file gets
>>>>> saved successfully. I'm using OOo 2.0.4.
>>>> Your mail is quite old now and I discovered it only accidently. I would
>>>> like to hear if you solved the problem by yourself. If it still appears
>>>> perhaps you can describe how you created the style you have inserted.
>>> No, I unfortunately didn't have time to look at it any closer. The code
>>> is along the lines attached below. The cases for ParagraphStyle and
>>> CharacterStyle share the same code and getPropertyType() and
>>> getFamilyType are helper functions inside my code that differentiate
>>> between them.
>>>
>>> Did you run into the same problem? I didn't find time yet to try it with
>>> OOo 2.1.
>>
>> I can't reproduce the problem in OOo2.2RC with the following Basic macro:
>>
>> doc = ThisComponent
>>
>> style = doc.createInstance("com.sun.star.style.CharacterStyle")
>> ' applying some properties to the style here...
>>
>> sName = "MyStyle"
>> fam = doc.StyleFamilies.getByName("CharacterStyles")
>> fam.insertByName(sName, style)
>>
>> After running this macro I can see the new character style in the
>> Stylist window and I could save my document without a problem.
>> Please try if you can do this in your version also.
>
> Thanks. I will, but I probably won't find time until June or so and I
> will then try it with a recent stable or development version.
I meant: try it in the version you have installed. I think the macro
will run fine in 2.0.4 also. If not, this version had a bug that now is
fixed. If it runs, the bug is in your code.
Ciao,
Mathias
--
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS
Please don't reply to "[EMAIL PROTECTED]".
I use it for the OOo lists and only rarely read other mails sent to it.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]