VintaSoft Office .NET Plug-in Discussions
Questions, comments and suggestions concerning VintaSoft Office .NET Plug-in.
Board index < VintaSoft Imaging < VintaSoft Office .NET Plug-in Discussions
public static void ConvertExcelToPDF(string filePath, string outputPath)
{
// Use OpenXML editor to export the xlsx to pdf. This allows text in the workbook
// to be captured and saved in TextRegion of page. Previously we rendered an image
// of the worksheet which didn't capture the text values.
using (XlsxDocumentEditor editor = new XlsxDocumentEditor(filePath))
{
// When exporting, the editor would create an oddly sized page. Using DocumentLayoutSettings to
// instruct the export to create a standard (8.5x11in) sized document.
DocumentLayoutSettings documentLayoutSettings = new DocumentLayoutSettings()
{
PageLayoutSettings = new PageLayoutSettings(ImageSize.FromPaperKind(PaperSizeKind.Letter, DocumentResolution)),
};
RenderingSettings renderingSettings = new RenderingSettings(DocumentResolution);
documentLayoutSettings.EnvironmentProperties.SourceFilename = outputPath;
editor.Export(outputPath, documentLayoutSettings, renderingSettings);
}
using (PdfDocument document = new PdfDocument(outputPath))
{
// This saves the converted file with our standard compression settings.
using (new StopwatchLog($"Optimizing and saving PDF file after conversion from Excel file."))
{
SavePdfDocument(document, outputPath);
}
}
}
The stack trace has some unrecognizable information, but it does seem to indicate something within OpenXml.Xlsx is having issues:
at ᥠ.зЏ°(бµЄ A_0) at ᥠ.и¬ѓ(뇛 A_0, б§ѓ A_1, б·® A_2) at б¦.зЏ°(뇛 A_0) at бЈЅ.зЅ“(кєЊ A_0) at л’›.зЏ°(кєЊ A_0) at бў°.зЅ“(кєЊ A_0) at л’›.зЏ°(кєЊ A_0) at бЈ†.зЅ“(кєЊ A_0) at л’›.зЏ°(кєЊ A_0) at бў».зЅ“(кєЊ A_0) at л’›.зЏ°(кєЊ A_0) at лќђ.зЄ™(лґі A_0) at л®І.зЅ“(кєЊ A_0) at л’›.зЏ°(кєЊ A_0) at л¤ї.зЄ™(лґі A_0) at л®І.зЅ“(кєЊ A_0) at л’›.зЏ°(кєЊ A_0) at 륫.зЄ™(лґі A_0) at л®І.зЅ“(кєЊ A_0) at л’›.зЏ°(кєЊ A_0) at л©Ё.зЄ™(лґі A_0) at Vintasoft.Imaging.Office.OpenXml.Xlsx.XlsxDocument.зЏ°(л©Ё A_0, 뇛 A_1, л©і A_2) at Vintasoft.Imaging.Office.OpenXml.Xlsx.XlsxDocument.зЏ°(л¦ў A_0) at Vintasoft.Imaging.Office.OpenXml.Xlsx.XlsxDocument.LayoutCore() at Vintasoft.Imaging.Office.OpenXml.Xlsx.XlsxDocument.get_Pages() at Vintasoft.Imaging.Office.OpenXml.Xlsx.XlsxDocument.get_PageCount() at Vintasoft.Imaging.Codecs.Decoders.OpenXmlDecoder`1.GetPageCount() at Vintasoft.Imaging.Codecs.Decoders.DecoderBase.get_PageCount() at вє.вљў(Stream A_0, Boolean A_1, String A_2, вљў A_3, в›Ѓ A_4) at в¦Љ.вљў(Stream A_0, Boolean A_1) at Vintasoft.Imaging.ImageCollection.Insert(Int32 index, Stream stream, Boolean closeStreamAfterUse) at Vintasoft.Imaging.ImageCollection.Insert(Int32 index, Stream stream) at Vintasoft.Imaging.ImageCollection.Add(Stream stream) at Vintasoft.Imaging.Office.OpenXml.Editor.OpenXmlDocumentEditor.Export(Stream stream, EncoderBase encoder, DocumentLayoutSettings layoutSettings, RenderingSettings renderingSettings) at Vintasoft.Imaging.Office.OpenXml.Editor.OpenXmlDocumentEditor.Export(String filename, DocumentLayoutSettings layoutSettings, RenderingSettings renderingSettings) at IS.WM.Architecture.Utilities.VintaSoftPDFLibrary.ConvertExcelToPDF(String filePath, String outputPath) in D:\Git\DocuTrack\Projects\Architecture\DocumentImagingUtilities\VintaSoftPDFLibrary.cs:line 1436Please advise on how to proceed as I cannot debug within Export to figure out what our the cause of our issue. I have a test file which will trigger it every time, but I do not see a way to upload it to this forum post creation page.