Hi Alexey,
Thank you for your suggestion & service.
We tried & implemented the workaround that you had suggested in previous post. But unfortunately it is not working as per the requirements.
I am using Aspose word version 7.0.0.0
The smaple code is as follows.
private void button17_Click(object sender, EventArgs e)
{
string path = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
//Initialize Aspose license.
Aspose.Words.License lic = new Aspose.Words.License();
lic.SetLicense(path + @"\Aspose.Total.lic");
Aspose.Pdf.License lic1 = new Aspose.Pdf.License();
lic1.SetLicense(path + @"\Aspose.Total.lic");
Document doc = new Document();
DocumentBuilder documentBuilder = new DocumentBuilder(doc);
//set the page size.
//set the page set-up
PageSetup pageSetup = documentBuilder.CurrentSection.PageSetup;
pageSetup.PaperSize = PaperSize.A4;
documentBuilder.Font.Name = “arial unicode MS”;
string str = File.ReadAllText(@“C:\Documents and Settings\amit.saraf\Desktop\chinese(PRB)\Copy of CHZ.txt”);
byte[] htmlBytes = Encoding.UTF7.GetBytes(str);
// Create html stream.
MemoryStream htmlStream = new MemoryStream(htmlBytes);
// Create temporary docuemnt from stream.
Document tmp = new Document(htmlStream, “”, LoadFormat.Html, “”);
// Insert temporary docuemnt into the main document.
InsertDocument(documentBuilder.CurrentParagraph, tmp);
doc.Save(“chinese.doc”);
StartWord(“chinese.doc”);
}
public void InsertDocument(Node insertAfterNode, Document srcDoc)
{
// Make sure that the node is either a pargraph or table.
if ((!insertAfterNode.NodeType.Equals(NodeType.Paragraph)) &
(!insertAfterNode.NodeType.Equals(NodeType.Table)))
throw new ArgumentException(“The destination node should be either a paragraph or table.”);
// We will be inserting into the parent of the destination paragraph.
CompositeNode dstStory = insertAfterNode.ParentNode;
// This object will be translating styles and lists during the import.
NodeImporter importer = new NodeImporter(srcDoc, insertAfterNode.Document, ImportFormatMode.KeepSourceFormatting);
// Loop through all sections in the source document.
foreach (Section srcSection in srcDoc.Sections)
{
// Loop through all block level nodes (paragraphs and tables) in the body of the section.
foreach (Node srcNode in srcSection.Body)
{
// Let’s skip the node if it is a last empty paragarph in a section.
if (srcNode.NodeType.Equals(NodeType.Paragraph))
{
Paragraph para = (Paragraph)srcNode;
if (para.IsEndOfSection && !para.HasChildNodes)
continue;
}
// This creates a clone of the node, suitable for insertion into the destination document.
Node newNode = importer.ImportNode(srcNode, true);
// Insert new node after the reference node.
dstStory.InsertAfter(newNode, insertAfterNode);
insertAfterNode = newNode;
}
}
}
Please refer the attached documents.
1>The sample text document containing the input text in chinese format.
2> The output of the sample code in word format.
I have some doubts regarding with this
1> Is this issue is ocurred due to “Arial Unicode Font”?
2> Is there any Other work-around that we can try out since we need to have some solution to this problem ASAP.
3> Is this problem persist for all asian languages like chinese,korean etc?
4> Can we expect this problem to be get resolved in coming Aspose update ?
if no then please can you give us some rough timeline nearby which we can expect the exact solution from aspose ?
Waiting for your Reply…!!!
Regards,
Dwarika