List Info

Thread: New CharacterStyle makes text document unsaveable




New CharacterStyle makes text document unsaveable
user name
2007-02-21 10:04:24
Hi all

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.

Any ideas?

Thanks

Arthur

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: New CharacterStyle makes text document unsaveable
user name
2007-03-22 10:16:32
Hi Arthur,

I'm cc'ing you directly as I don't know if you still
participate in this
list.

Arthur wrote:

> Hi all
> 
> 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.

Ciao,
Mathias

-- 
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/Gu
llFOSS
Please don't reply to "nospamformbagmx.de".
I use it for the OOo lists and only rarely read other mails
sent to it.

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: New CharacterStyle makes text document unsaveable
user name
2007-03-22 10:36:20
Hi Mathias

>> 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.

Regards

Arthur


       com.sun.star.lang.XMultiServiceFactory mxFactory = 
(com.sun.star.lang.XMultiServiceFactory)com.sun.star.uno.Uno
Runtime 
       
.queryInterface(com.sun.star.lang.XMultiServiceFactory.class
, doc);

  xStyle =
(com.sun.star.style.XStyle)com.sun.star.uno.UnoRuntime
            
.queryInterface(com.sun.star.style.XStyle.class, mxFactory
                   .createInstance(getPropertyType()));

// applying some properties to the style here...

       com.sun.star.style.XStyleFamiliesSupplier xSupplier =

(com.sun.star.style.XStyleFamiliesSupplier)com.sun.star.uno.
UnoRuntime 
 
.queryInterface(com.sun.star.style.XStyleFamiliesSupplier.cl
ass, doc);

       com.sun.star.container.XNameAccess xFamilies = 
(com.sun.star.container.XNameAccess)com.sun.star.uno.UnoRunt
ime
            
.queryInterface(com.sun.star.container.XNameAccess.class, 
xSupplier.getStyleFamilies());

       com.sun.star.container.XNameContainer xFamily = 
(com.sun.star.container.XNameContainer)com.sun.star.uno.UnoR
untime
            
.queryInterface(com.sun.star.container.XNameContainer.class,

                   xFamilies.getByName(getFamilyType()));

  xFamily.insertByName(name, xStyle);

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: New CharacterStyle makes text document unsaveable
user name
2007-03-23 02:30:14
Arthur wrote:

> Hi Mathias
> 
>>> 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&q
uot;)
	' 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.

In case you can the problem either is in your code or in the
properties
you have applied to your style.

Ciao,
Mathias


-- 
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/Gu
llFOSS
Please don't reply to "nospamformbagmx.de".
I use it for the OOo lists and only rarely read other mails
sent to it.

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: New CharacterStyle makes text document unsaveable
user name
2007-03-23 03:40:56
>>>> 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&q
uot;)
> 	' 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.

Regards

Arthur


------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: New CharacterStyle makes text document unsaveable
user name
2007-03-23 12:43:00
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&q
uot;)
>> 	' 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/Gu
llFOSS
Please don't reply to "nospamformbagmx.de".
I use it for the OOo lists and only rarely read other mails
sent to it.

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )