Converting XL to PDF to Word yields incorrect output

Hi Aspose Team,
I’m trying to convert an excel to word by first converting the excel worksheet to PDF and converting the PDF doc to word using the following code:

Workbook workbook = new Workbook(dir + @"\Test_09122025\XLOutput.xlsx");

Worksheet sheet = workbook.Worksheets[0];

PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();

string pdfFile = dir + @"\Test_09122025\PDFOutput.pdf";

if (File.Exists(pdfFile))
    { File.Delete(pdfFile); }
workbook.Save(pdfFile, pdfSaveOptions);


Document doc = new Document(pdfFile);
string wordFile = dir + @"\Test_09122025\XLOutput.xlsx";
if (File.Exists(wordFile))
    { File.Delete(wordFile); }
doc.Save(wordFile, Aspose.Words.SaveFormat.Docx);

The PDF output looks close enough to the excel but the word output looks extremely off compared to both PDF and Excel.
In excel, you’ll notice that each question has a few responses in the rows following the question, and these are misrepresented in word and even extra responses are showing up in word somehow. Could you help me identify what I’m doing wrong here?
Test_09122025.zip (126.4 KB)

Thanks.

@JThomas98

It appears that the issue you’re experiencing with the conversion from Excel to Word via PDF may be related to how the content is structured and interpreted during the conversion process. Here are some suggestions to help improve the output:

  1. Check PDF Conversion Options: If you are using PdfSaveOptions, ensure that they are configured correctly to preserve the layout and formatting of the Excel sheet. Explore additional options within PdfSaveOptions that may help maintain the structure.

  2. Direct Excel to Word Conversion: Instead of converting to PDF first, consider converting the Excel file directly to Word. Aspose.Cells allows you to save an Excel file directly as a Word document, which may yield better results. Here’s a sample code snippet:

    Workbook workbook = new Workbook(dir + @"\Test_09122025\XLOutput.xlsx");
    string wordFile = dir + @"\Test_09122025\XLOutput.docx";
    workbook.Save(wordFile, SaveFormat.Docx);
    
  3. Review the Content Structure: If the Excel sheet contains complex formatting or merged cells, it may not translate well into Word. Simplifying the structure in Excel before conversion could improve the outcome.

  4. Post-Processing in Word: After conversion, you may need to manually adjust the Word document to correct any misalignments or formatting issues that arise.

If these suggestions do not resolve the issue, please provide more details about the specific formatting or content that is not being preserved, and I can assist further.

@JThomas98
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-28649

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Please note, Aspose.Words is designed to work with MS Word documents. MS Word documents are flow documents and they have structure very similar to Aspose.Words Document Object Model. On the other hand PDF documents are fixed page format documents. While loading PDF document into Aspose.Words DOM, Fixed Page Document structure into the Flow Document Object Model. Unfortunately, such conversion does not guaranty 100% fidelity. So it is not always possible to retain PDF document layout after processing PDF document using Aspose.Words.

1 Like