Hello,
I’m having an issue about AsposeWords,
I’m currently on version 18.3, but for the test I updated to version 24.1, which is about the FieldListNumber. Here the context:
- We create a Word LISTNUM by this way: go to Insert > Text > Explore Quick Parts > Field> Insert Field.
In the Field names list, we pick ListNum
In the List name, we select LegalDefault
In Field options, we check Level in the list and put value 1
This will give:
{ LISTNUM LegalDefault \l 1}
First Level
I continue my document and I will have this structure:
{ LISTNUM LegalDefault \l 1}
First
Text of my first
{ LISTNUM LegalDefault \l 1}
Second
Text of my second
{ LISTNUM LegalDefault \l 2}
Second First
Text of my second first
{ LISTNUM LegalDefault \l 2}
Second Two
Text of my second two
And visually:
-
First
Text of my first
-
Second
Text of my second
2.1. Second First
Text of my second first
2.2. Second Two
Text of my second two
The issue is the following, when I save this word as pdf with method .save(“myDoc.pdf”)
the result in the PDF is not as expected, the format of ListNumberFields
is different:
1)First
Text of my first
2)Second
Text of my second
a) Second First
Text of my second first
b) Second Two
Text of my second two
There are parenthesis whereas it should be dot, and the level 2 of FieldNumberList
where supposed to be 2.1. and it is a)
In attachments:
- InitialWord.doc the initial word file use with the good NumList (OK)
- FinalPdf.pdf the pdf when saved with the bad results NumList (KO)
- FinalWord.doc the word when saved with the bad results NumList when I use updatePageLayout method or when I use updateFields(); and then unlinkFields(); before save method, it results bad formating of NumList (KO)
Files.7z (1.0 MB)
@amepage On my side InitialWord.doc
and FinalWord.doc
documents look the same. Could you please make sure you have uploaded correct input document? In both documents numbers are with parenthesis.
Hello Alexey,
I think the real problem is about the language. As I’m french, my word language for the office display is french. So in my InitialWord file, I have the dots => 1. First level
I switch the word language for the office display to english, and when I open it, I have parenthesis. So maybe it is a problem of the language when I use AsposeWords in Java, when I load the word with class Document, it is set to english, and when I save it, it has the same behaviour when I did it manually, and like you, your word language is set to english, that’s why you have parenthesis when you opened it.
Is there a way to set the language when it is saved? I just find this issue, is that what I need?
https://forum.aspose.com/t/using-aspose-words-how-to-set-the-pdf-language-when-word-document-is-saved-as-pdf-file/229476/4
@amepage
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-26771
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Yes, you are right, the problem occurs because name of the list in LISTNUM
field is specified in French. You can use the following code to get the expected output:
Document doc = new Document("C:\\Temp\\in.doc");
for (Field f : doc.getRange().getFields())
{
if (f.getType() == FieldType.FIELD_LIST_NUM)
{
FieldListNum listNum = (FieldListNum)f;
if (listNum.getListName().equals("LégalDéfaut"))
listNum.setListName("LegalDefault");
}
}
doc.save("C:\\Temp\\out.pdf");
Thank you @alexey.noskov , it is working well with the code you give, before the issue is delivered in a fix version.
1 Like
The issues you have found earlier (filed as WORDSNET-26771) have been fixed in this Aspose.Words for Java 24.11 update.