Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Fri Apr 22, 2016 2:25 am

When I insert a html string that means a html table to a paragraph ,the result shows the table in the word has no borders .
I have find the reason ,it is the origian docx file contains a table that has no border .How can we avoid this?
following is the code :
Code: Select all
Document document = new Document();
            document.LoadFromFile(file);
           
            string htmlTable = "<sub><table border=\"1\"  cellpadding=\"5\"  cellspacing=\"0\" style=\"table-layout:fixed;\" xmlns:exsl=\"urn:schemas-microsoft-com:xslt\">" +
    "<tbody><tr><td rowspan=\"2\" align=\"left\"><p>100</p></td><td>200</td><td><p>300</p></td></tr>" +
    "<tr><td><p>500</p></td><td><p>600</p></td></tr></tbody>" +
    "</table></sub>";
            Paragraph paragraph = new Paragraph(document);
            Section section = document.Sections[0];
            section.Paragraphs.Insert(2, paragraph);//

            paragraph.AppendHTML(htmlTable);
            //Save doc file.
            document.SaveToFile("Sample.docx", FileFormat.Docx);

            //Launching the MS Word file.
            WordDocViewer("Sample.docx");

iceblueDDX123
 
Posts: 34
Joined: Tue Apr 19, 2016 9:43 am

Fri Apr 22, 2016 3:39 am

Hi,

Thanks for your posting.
Your html table tag was setted the border, <table border=\"1\"...>. And I tested your code with Spire.Doc Pack(hot fix) Version:5.6.62. The table in result .docx file has borders. Please try the version.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Fri Apr 22, 2016 9:58 am

amy.zhao wrote:Hi,

Thanks for your posting.
Your html table tag was setted the border, <table border=\"1\"...>. And I tested your code with Spire.Doc Pack(hot fix) Version:5.6.62. The table in result .docx file has borders. Please try the version.

Best Regards,
Amy
E-iceblue support team

thank you for your reply.
Yes ,you are right,but if edit the docx file use office word and set a table with no border, then use 5.6.62 version Spire.doc to insert a table with border ,the latter table will be no border.

iceblueDDX123
 
Posts: 34
Joined: Tue Apr 19, 2016 9:43 am

Mon Apr 25, 2016 2:11 am

Hi,

Sorry for the delayed response as weekends here.
I did a testing according to your issue description but didn't replicate your issue. To help us replicate it and work out solution, please share all your code and your docx documents.
Thank you.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Mon Apr 25, 2016 7:54 am

amy.zhao wrote:Hi,

Sorry for the delayed response as weekends here.
I did a testing according to your issue description but didn't replicate your issue. To help us replicate it and work out solution, please share all your code and your docx documents.
Thank you.

Best Regards,
Amy
E-iceblue support team

It is a little long ,but thanks all the way .
I have use another solution. thank you !

iceblueDDX123
 
Posts: 34
Joined: Tue Apr 19, 2016 9:43 am

Mon Apr 25, 2016 8:04 am

Hi,

Thanks for your response.
Welcome to write to us again for further problems.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.Doc