Why the locale id differs for Aspose generated blank doc

Hi there,
#1. We noticed that the blank document generated by Document() constructor has the font locale which does not match to any valid locale.

for ex:
Document n = new Document();
for (Style st : n.getStyles()) {
if (st.getFont() == null)
continue;
System.out.println(st.getFont().getLocaleId());
System.out.println(st.getFont().getLocaleIdBi());
System.out.println(st.getFont().getLocaleIdFarEast());
}

another way is to iterate through all the run nodes and access the locale for the run level fonts.

and one way is to create the DocumentBuilder object
Document n = new Document();
DocumentBuilder db = new DocumentBuilder(n);
System.out.println(db.getFont().getLocaleId());
System.out.println(db.getFont().getLocaleIdBi());
System.out.println(db.getFont().getLocaleIdFarEast());

All above prints values to 1024 (for locale idm locale id bi, loacle id far east) which is not valid locale id. Please visit - Microsoft Support for all valid locale ids.

PS: We noticed the default font for Normal.dotm template used for Blank Document generated by Aspose constructor (new Document()) is ‘Times New Roman’. The locale might be 1024 because of this. Please confirm.

#2. Office generated word document has locale id 1033 which is valid. Why Aspose doesn’t generates the document with same locale as par the Microsoft word.

PS: We noticed the default font for Normal.dotm template used for MS Office generated document is default ‘Calibri’ (at least in 2007 Office) and locale might be 1033 because of this. Please confirm.

Template could be located at - C:\Users\UserName\AppData\Roaming\Microsoft\Templates\Normal.dotm.

#3. Does the word document generated by Aspose in different countries, would have different locales?

#4. Does the word document generated by Microsoft word in different countries, would have different locales and Aspose would mimic the same?

PS:
#5. Does the word document generated by Aspose on different operating systems would have different locales?

#6. Is it good thing to change the locale of font? I mean what adverse affect on word document it can make to change the locale of default font?


It would be helpful if you clarify each query separately.
Thanks.

Hi Praneeth,


Thanks for your inquiry. First of all, please try creating an empty DOCX using Microsoft Word 2013 on your side and use it as a start document as follows:
Document n = new Document(C:\temp\Doc1.docx);
for (Style st : n.getStyles()) {
if (st.getFont() == null)
continue;
System.out.println(st.getFont().getLocaleId());
System.out.println(st.getFont().getLocaleIdBi());
System.out.println(st.getFont().getLocaleIdFarEast());
}
In case when you load Microsoft Word 2013 generated document in Aspose.Words’ DOM, the above code won’t return 1024 value for locales.

However, in your case, the problem occurs because currently Aspose.Words uses “Blank.doc” as a start document in case you create an empty document using the following constructor:
Document n = new Document();
This “Blank.doc” is embedded in Aspose.Words API and was created using Microsoft Word 2003.

So it depends on the document loaded in Aspose.Words DOM. I hope, this helps.

Best regards,

Hi Awais,
As we can see Aspose allows us to set the locale of the font, does it make any change to the document font. I mean does it not corrupts the font? Is it allowed to change the font locale without changing other properties of the font.

Thanks.

Hi Praneeth,


Thanks for your inquiry. If you are changing locale of the font of a Run, then it will be applicable to that specific Run of text only. This does’t change locale of whole document. Secondly, yes, it is allowed to change the font locale without changing other properties of the font.

Best regards,