Hi Everyone,
I've been trying to copy textFields with custom numberFormat across writer
documents. It seems that the NumberFormat is copied, but the copied
textField doesn't point to it after being copied.
Following is the sequence of actions which i executed using Java API.
1. In writer document_1 ,i created a textfield(say, FieldA) with a
UserDefined NumberFormat(say, FormatA)
2. In writer document_2 ,i created a textfield(say, FieldB) with a
UserDefined NumberFormat(say, FormatB)
Note: -> 'FormatA' and 'FormatB' are different.
-> In both the cases the NumberFormat id created was '5116', using
command:
availNumFormats.addNew(newNumFormat, locale);
3. Till now everything seems fine. But now, i copied the 'FieldB' from
'document_2' into the 'document_1'.
4. Now the FormatString that 'FieldB' (in document_1) refers to is not
correct. (It now points to the number format 'FormatA' , which should have
been 'FormatB'.
Same behavior can be reproduced in the GUI too. Is this a bug or a behavior
?
P.S When the 'FieldB' is copied to document_1, i can see that the original
number format 'FormatB' is now also available in document_1. But 'FieldB' no
more points to it.
I'm posting pieces of code which would also give an idea of the flow:
//Create a new number format
XNumberFormatsSupplier numFSupplier = (XNumberFormatsSupplier)
UnoRuntime.queryInterface(XNumberFormatsSupplier.class, doc);
XNumberFormats availNumFormats = numFSupplier.getNumberFormats();
int id = availNumFormats.addNew(newNumFormat, locale);
//Set the numberFormat prop of the XDependentTextField
XPropertySet prop = UNO.queryPropertySet(depTextField);
prop.setPropertyValue("NumberFormat", id);
//After copying the TextField into the other document.
//Extract the Number format prop set. using the NumberFormat of the
XDependantText field.
XPropertySet formatProp = availFormats.getByKey(id);
System.err.println("Format = " + formatProp
.getPropertyValue("FormatString"));
Any pointers regarding this will be of great help!
Regards,
--
View this message in context:
http://old.nabble.com/Issues-Copying-%28across-documents%29-TextFields-with-UserDefined-NumberFormat-tp27343406p27343406.html
Sent from the openoffice - dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]