Problem For Creating Table with HTML tag in Chinese Language

Hi Alexey,

I am facing a problem while creating the table by using HTML tags.

This is happened only for chinese language.

I am using Aspose version 7.0.0.0

Please,refer attached document indicating output in English & Chinese Language.

If you observe both the document properly. You will find that for english language the table containing text is coming properly.

But for chinese document the entire table is going out of page. If u seen the chinese text properly then you can notice that the text is not wrapped inside the table automatically.

The sample 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)\Eng-rule.txt”);

//string str = File.ReadAllText(@“C:\Documents and Settings\amit.saraf\Desktop\chinese(PRB)\CHZ.txt”);

documentBuilder.InsertHtml(str);

doc.Save(“chinese.doc”);

StartWord(“chinese.doc”);

}

The Sample TXT files used in this program is also attached with this post.

The Sample document coming out of sample code is also attached with this thread.

Note: Even we also modified the HTML table tag as

<TABLE width="50%" still the width of the table is not coming into effect for chinese table.

1> If you can reproduce this problem then will u please tell us that when we will expect this issue to be fixed & in which future release of ASPOSE?

2> Is this issue is only restricted to chinese language or it is also available with other asian languages like ( Korean, Japanese Etc.)

3> Is there any work around to fix this issue?

We are waiting for your reply…

Thanks & Regards,

Dwarika

Hi Dwarika,

Thanks for your request. This is the same issue as you mentioned in another your thread:

My advice is the same – try using workaround suggested in the thread above.

Best regards.

Hi Alexey,

Thanks For your Quick reply.

I already gone through your suggestion where you suggest Us to import the entire document & then use it.

We cannot import the document since we are generating this document programmatically.

According to my understanding your work-around will be useful if we already have any word doc ready for processing.

Will you please let me know what you want to say in detail?

Is it possible for you to send me an sample code that how your suggected work-around will solve my problem?

Thanks & Regards,

Dwarika.

Hi

Thanks for your request. Here is sample code:

// Create document and DocuemntBuilder

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

PageSetup pageSetup = builder.CurrentSection.PageSetup;

pageSetup.PaperSize = PaperSize.A4;

builder.Font.Name = “arial unicode MS”;

// Get html string (in my case i read it from file).

string html = File.ReadAllText(@“Test001\CHZ.txt”);

// Create an intermediate document from HTML.

// First convert HTML strign to byte array.

byte[] htmlBytes = Encoding.UTF7.GetBytes(html);

// 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(builder.CurrentParagraph, tmp);

// Save output document.

doc.Save(@“Test001\out.doc”);

You can find InsertDocument method here:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/howto-insert-a-document-into-another-document.html

Hope this helps.

Best regards.

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


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