We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Border Issue while converting to word docx file

Hi Tahir,

I am facing an issue with table/cell borders while converting the aspose.word Document to Ms Word Doc.

Below is my code :

Document docFinalRep = data.GenerateReportInPdf();
docFinalRep.Save("D:\\Soft\Aspose\\" + fileName);
docFinalRep.Save(streamMemory, SaveFormat.Docx);
Response.AppendHeader("Content-Type", "application/doc");

Inside GenerateReportInPdf(),

I will merge some html report templates and create a html string of entire report, which i later build with DocumentBuilder and do some settings using PageSetup and the resulting document is returned by this fn.

I even tried all options to remove table and cell border while creating html string.

But still , when it is converted to MS Word Doc, it shows border.

Please help me

Hi Sangeetha,

Thanks for your inquiry. It would be great if you please share following detail for investigation purposes.

  • Please attach your input Word documents.
  • Please

create a standalone/runnable simple application (for example a Console
Application Project
) that demonstrates the code (Aspose.Words code) you used to generate
your output document

  • Please attach the output Word file that shows the undesired behavior.
  • Please
    attach your target Word document showing the desired behavior. You can
    use Microsoft Word to create your target Word document. I will
    investigate as to how you are expecting your final document be generated

it is difficult to say what the problem is without the Document(s) and
simplified application. We need your Document(s) and simple project to
reproduce the problem. As soon as you get these pieces of information to
us we’ll start our investigation into your issue.

Hi Tahir,

  1. I have attached a sample code project , sample.zip

  2. Also attached a zipped sample report.html, which should be placed in the path “D:\Soft\Aspose\report.html”. or do changes in code.

  3. Word file will be created in the path " D:\Soft\Aspose\FinalReport.docx".
    In code, please change the file path under the event ‘btnWord_Click’.
    Please change this path if needed.

I have also attached a sample FinalReport.docx for your reference.

Please assist me on this.


Hi Sangeetha,

Thanks for sharing the detail. I have tested the scenario and have not found the shared issue. There is no table’s border in output Pdf/Docx. Please check the attached image for detail. I have checked the output Docx in MS Word 2013 and 2010.

In your case, I suggest you please use Table.ClearBorders method. This method removes all table and cell borders on this table. Please check the following code snippet.

Document doc = new Document(MyDir + "report.html");
foreach (Table table in doc.GetChildNodes(NodeType.Table, true))

Hi Tahir,

I got an error message as follows when i tried to apply the code:

‘Aspose.Words.Tables.Table’ does not contain a definition for ‘ClearBorders’ and no extension method ‘ClearBorders’ accepting a first argument of type ‘Aspose.Words.Tables.Table’ could be found (are you missing a using directive or an assembly reference?)

In my code both directives are there:

using Aspose.Words;
using Aspose.Words.Tables;

Also version used is 10.0.0. You can verify these in the above sample code project.

Am i still missing any ?


Hi Sangeetha,

for your inquiry. I suggest you please use the latest version of Aspose.Words for .NET 14.10.0. You may use the following code example to achieve your requirements. Hope this helps you.

Document doc = new Document(MyDir + "in.docx");
foreach (Cell cell in doc.GetChildNodes(NodeType.Cell, true))
doc.Save(MyDir + "Out.docx");

Hi Tahir,

Thank you so much for your support.

I tried both the options you suggested. I tried with latest version of Aspose.Words for .Net 14 and also tried to open the report using Microsoft Word 2010.

  1. Without any code change, its working perfectly in Microsoft Word 2010. No border appear here.

  2. But using the Aspose.Words for .Net 14, along with the code change as mentioned by you previously, its not working. It still shows border in MSWord 2003. i tried both: table.ClearBorders(); and cell.CellFormat.Borders.ClearFormatting(); Still it shows border in MSWord 2003.

Is there any compatibility issue? I mean , does ,Aspose.Words dll version 10, support MS Word version below MS Word 2010?


Hi Sangeetha,

Thanks for your inquiry. Please note that MS Word 2003 shows the border when table has no borders. This is the default behavior for showing table in MS Word 2003. However, MS Word 2013 and 2010 do not show these borders.

Please let us know if you have any more queries.

Hi Tahir,

Thank you for your support. No more queries on this …


Hi Sangeetha,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.