Thread: [Solved] Excel to PDF
View Single Post
 
Old 03-21-2012, 07:13 AM
smk2001in smk2001in is offline Windows XP Office 2007
Novice
 
Join Date: Mar 2012
Posts: 1
smk2001in is on a distinguished road
Default Excel to PDF

HI

i have created a program which takes excel file path and directly exports to the pdf format using office in c#.

my problem is while exports it shows the notification of preogressbar. i dont want this progressbar. how to disable this. i used Application.disablealert=true. but no use help me

below is my code
-----------------
ApplicationClass excelApplication = newApplicationClass();
Workbook excelWorkBook = null;
excelApplication.DisplayAlerts =
false;
string paramSourceBookPath = @"E:\indata\BAC\FileSplitter\Ready\EDOC0E159851057 44D5BA91BECCCFB0D111F\Kelly_FaxImage_JobID_updated .xlsx";
object paramMissing = Type.Missing;
string paramExportFilePath = @"C:\Test.pdf";
XlFixedFormatType paramExportFormat = XlFixedFormatType.xlTypePDF;
XlFixedFormatQuality paramExportQuality =
XlFixedFormatQuality.xlQualityStandard;
bool paramOpenAfterPublish = false;
bool paramIncludeDocProps = true;
bool paramIgnorePrintAreas = true;
object paramFromPage = Type.Missing;
object paramToPage = Type.Missing;
try
{
// Open the source workbook.

excelWorkBook = excelApplication.Workbooks.Open(paramSourceBookPat h,
paramMissing, paramMissing, paramMissing, paramMissing,
paramMissing, paramMissing, paramMissing, paramMissing,
paramMissing, paramMissing, paramMissing, paramMissing,
paramMissing, paramMissing);
// Save it in the target format.
if (excelWorkBook != null)
excelWorkBook.ExportAsFixedFormat(paramExportForma t,
paramExportFilePath, paramExportQuality,
paramIncludeDocProps, paramIgnorePrintAreas, paramFromPage,
paramToPage, paramOpenAfterPublish,
paramMissing);
}
catch (Exception ex)
{
// Respond to the error.
}
finally
{
// Close the workbook object.
if (excelWorkBook != null)
{
excelWorkBook.Close(
false, paramMissing, paramMissing);
excelWorkBook =
null;
}
// Quit Excel and release the ApplicationClass object.
if (excelApplication != null)
{
excelApplication.Quit();
excelApplication =
null;
}
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
GC.WaitForPendingFinalizers();
Reply With Quote