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

Free Support Forum - aspose.com

Table StyleOptions are not converted

Hello!

We are using Aspose to convert DOCX to PDF and we have found the issue with pdf tag stracture for table style options. It seams that all DOCX table cells are converted to < TD > tag, hovewer some of them should be converted to < TH > tag.

Steps to reproduce

  1. Run code below. Code converts DOCX file with tables to PDF/A-1b
  2. Open result PDF with Adobe
  3. Review tag structure of the tables (you can convert DOCX file with Adobe and compare files tags)

Actual result
All cells are converted as < TD > tag

Expected result:
1st table
Cells of first row and first column are converted as < TH > (because source DOCX table style is “Header Row” and “First Column”)
2nd table
Cells of first row are converted as < TH > (because source DOCX table style is “Header Row” )
3d table (589 Bytes)
Cells of first column are converted as < TH > (because source DOCX table style is “First Column” )

TableIssue.zip (16.5 KB)

Code:

using System;
using Aspose.Words;
using Aspose.Words.Saving;
using Aspose.Words.Tables;

namespace TableIssue
{
   class Program
   {
        static void Main()
        {
            new License()
               .SetLicense("****.lic");

           var input = "Tables.docx";
           var output = "Table.pdf";

           var inputDocument = new Document(input);

           var pdfSaveOptions = new PdfSaveOptions();

           pdfSaveOptions.OutlineOptions.HeadingsOutlineLevels = 9;
           pdfSaveOptions.DisplayDocTitle = true;
           pdfSaveOptions.DmlRenderingMode = DmlRenderingMode.DrawingML;
           pdfSaveOptions.ExportDocumentStructure = true;
           pdfSaveOptions.Compliance = PdfCompliance.PdfA1b;
           pdfSaveOptions.ExportDocumentStructure = true;

           foreach (var node in inputDocument.GetChildNodes(NodeType.Table, true))
           {
                var table = (Table) node;
                Console.WriteLine($"Table style: {table.StyleOptions}");
           }

           inputDocument.Save(output, pdfSaveOptions);
      }
  }
}

@uaprogrammer

You issue seems related to Aspose.Words and we are moving this post to respective category where your will be assisted accordingly.

@uaprogrammer

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-21161 . You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-21161) have been fixed in this Aspose.Words for .NET 21.7 update and this Aspose.Words for Java 21.7 update.