Hi All,
My below code is working fine for convert excel document to PDF but its not Convert Entire Excel Doc Some Large excel Content Are cut
Please help me this is my code
public short excel2Pdf(string originalXlsPath, string pdfPath)
{
Console.WriteLine("Class: " + GetType() + " Method: " + MethodBase.GetCurrentMethod().Name + " Started ");
short convertExcel2PdfResult = -1;
// Create COM Objects
Microsoft.Office.Interop.Excel.Application excelApplication = null;
Microsoft.Office.Interop.Excel.Workbook excelWorkbook = null;
object unknownType = Type.Missing;
// Create new instance of Excel
try
{
//open excel application
excelApplication = new Microsoft.Office.Interop.Excel.Application
{
ScreenUpdating = false,
DisplayAlerts = false
};
//open excel sheet
if (excelApplication != null)
excelWorkbook = excelApplication.Workbooks.Open(originalXlsPath, unknownType, unknownType,
unknownType, unknownType, unknownType,
unknownType, unknownType, unknownType,
unknownType, unknownType, unknownType,
unknownType, unknownType, unknownType);
if (excelWorkbook != null)
{
// Call Excel's native export function (valid in Office 2007 and Office 2010, AFAIK)
excelWorkbook.ExportAsFixedFormat(Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF,
pdfPath,
unknownType, unknownType, unknownType, unknownType, unknownType,
unknownType, unknownType);
convertExcel2PdfResult = 0;
}
else
{
Console.WriteLine("Error occured for conversion of office excel to PDF ");
convertExcel2PdfResult = 504;
}
}
catch (Exception exExcel2Pdf)
{
Console.WriteLine("Error occured for conversion of office excel to PDF, Exception: ", exExcel2Pdf);
convertExcel2PdfResult = 504;
}
finally
{
// Close the workbook, quit the Excel, and clean up regardless of the results...
if (excelWorkbook != null)
excelWorkbook.Close(unknownType, unknownType, unknownType);
if (excelApplication != null) excelApplication.Quit();
Util.releaseObject(excelWorkbook);
Util.releaseObject(excelApplication);
}
Console.WriteLine("Class: " + GetType() + " Method: " + MethodBase.GetCurrentMethod().Name + " Ended ");
return convertExcel2PdfResult;
}

Mageshwaran RPosted Nov 21, 2019, 10:33 AM
Atir TahirPosted Sep 2, 2019, 2:00 PM
Mohamed AbedallahPosted Feb 7, 2019, 9:40 AM
https://www.leadtools.com/sdk/document/document-converter
Uehara AyakaPosted Mar 26, 2018, 9:27 PM
Sagar Pandurang KapPosted Mar 26, 2018, 12:41 AM