Free Support Forum - aspose.com

Locale in Aspose.Word

Hi,

i'm creating a document like this :

Document doc = new Document(Server.MapPath("screenscrapedHTML.htm"));

doc.Save(Server.MapPath("HTMLScrapedPage.doc"),SaveFormat.Rtf);

but when I open the document in Word, the default language is set to Russian. Can you let me know how to change it to English (UK) please?

Cheers


This message was posted using Aspose.Live 2 Forum

Hello

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I managed to reproduce the problem on my side. You will be notified as soon as it is resolved.

As a workaround you can specify LocaleId explicitly in your code.

Document doc = new Document("in.htm");

Node[] nodes = doc.GetChildNodes(NodeType.Run, true).ToArray();

// Loop throught all runs

foreach (Run node in nodes)

{

// Set English UK locale

// For the list of locale identifiers see http://www.microsoft.com/globaldev/reference/lcid-all.mspx

node.Font.LocaleId = 2057;

}

doc.Save("out.rtf");

Best regards,

Hi,

thanks for the response. I have successfully implemented this solution for the “Run” type of nodes, however, the Shape type (images) for the document are still being shown as having a default language of Russian! Is there any way round this?

Thanks

Hi

Thanks for your request. In this case, it is better to use DocumentVisitor to achieve this. Please follow the link to learn more about DocuemntVisitor:

Please try using the following code:

Document doc = new Document("in.htm");
LocaleIDChanger changer = new LocaleIDChanger(2057);
doc.Accept(changer);
doc.Save("out.rtf");

LocaleIDChanger class is attached.

Best regards,

Hi, thanks for the reply. I’ve decided to read in the html as a stream and then use insertHTML with the document builder which works beutifully as follows:

StreamReader sr = new StreamReader(Server.MapPath(“htmltest.htm”));
string htmlString = sr.ReadToEnd();
sr.Close();
Document doc = new Document();
DocumentBuilder db = new DocumentBuilder(doc);
db.Font.LocaleId = 2057;
db.InsertHtml(htmlString);

However, within the html, I have

surrounding some of the text, but the font-size is always 12pt in the word document. When I change the
to a , the font size shows up as 22pt in word.

Am I correct in thinking that
are not supported by Aspose and if so will it ever be supported?

Cheers

Hi

Thanks for your request. The problem occurs because, currently, Aspose.Words does not support inheriting styles from parent elements.
Currently, Aspose.Words expects that font formatting is set in element, formatting of paragraph – in

or

elements etc…
I linked your request to the appropriate issue, you will be notified as soon as it is resolved.

Best regards,

The issues you have found earlier (filed as 10652) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as WORDSNET-2021) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(46)

A post was split to a new topic: Change Locale in Aspose.Word