A
Aniyan_Remo
Hi,
I'm exporting data from Crystal Report to Excel. When I export I'm not
able to see the borders, hence I'm using Excel namespace in C# program for
showing border lines, the following is the code I'm using in the Web
Application (C# language):
using Excel;
string workbookPath = "c:/SomeWorkBook.xls";
ExportOptions export = new ExportOptions();
DiskFileDestinationOptions ex = new DiskFileDestinationOptions();
ex.DiskFileName=workbookpath;
export.DestinationOptions = ex;
ReportDocument.Export();
Excel.Application excelApp = new Excel.ApplicationClass();
excelApp.Visible = true;
Excel.Workbook excelWorkbook = excelApp.Workbooks.Open(workbookPath, 0,
false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0,
true, false, false);
Excel.Sheets excelSheets = excelWorkbook.Worksheets;
string currentSheet = "Sheet1";
Excel.Worksheet excelWorksheet =
(Excel.Worksheet)excelSheets.get_Item(currentSheet);
Excel.Range cell = excelWorksheet.UsedRange;
cell.Borders.get_Item(Excel.XlBordersIndex.xlEdgeTop ).LineStyle
=Excel.XlLineStyle.xlContinuous;
cell.Borders.get_Item(Excel.XlBordersIndex.xlEdgeBottom ).LineStyle
=Excel.XlLineStyle.xlContinuous;
cell.Borders.get_Item(Excel.XlBordersIndex.xlEdgeRight ).LineStyle
=Excel.XlLineStyle.xlContinuous;
cell.Borders.get_Item(Excel.XlBordersIndex.xlEdgeLeft ).LineStyle
=Excel.XlLineStyle.xlContinuous;
excelWorkbook.Save();
excelWorkbook.Close(Type.Missing,workbookpath,Type.Missing);
export.DestinationOptions = ex;
excelWorkbook = null;
excelSheets = null;
excelApp = null;
When I use the above code, the Excel application is running in the
background (I'm able to see the process running for that in the Task Manager)
under IUSR_<servername> and as well as under current user who as logged into
the terminal. So whenever I export data, that many times the Excel
Application are running in the process.
How to solve this problem? Pls help me out...
I'm exporting data from Crystal Report to Excel. When I export I'm not
able to see the borders, hence I'm using Excel namespace in C# program for
showing border lines, the following is the code I'm using in the Web
Application (C# language):
using Excel;
string workbookPath = "c:/SomeWorkBook.xls";
ExportOptions export = new ExportOptions();
DiskFileDestinationOptions ex = new DiskFileDestinationOptions();
ex.DiskFileName=workbookpath;
export.DestinationOptions = ex;
ReportDocument.Export();
Excel.Application excelApp = new Excel.ApplicationClass();
excelApp.Visible = true;
Excel.Workbook excelWorkbook = excelApp.Workbooks.Open(workbookPath, 0,
false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0,
true, false, false);
Excel.Sheets excelSheets = excelWorkbook.Worksheets;
string currentSheet = "Sheet1";
Excel.Worksheet excelWorksheet =
(Excel.Worksheet)excelSheets.get_Item(currentSheet);
Excel.Range cell = excelWorksheet.UsedRange;
cell.Borders.get_Item(Excel.XlBordersIndex.xlEdgeTop ).LineStyle
=Excel.XlLineStyle.xlContinuous;
cell.Borders.get_Item(Excel.XlBordersIndex.xlEdgeBottom ).LineStyle
=Excel.XlLineStyle.xlContinuous;
cell.Borders.get_Item(Excel.XlBordersIndex.xlEdgeRight ).LineStyle
=Excel.XlLineStyle.xlContinuous;
cell.Borders.get_Item(Excel.XlBordersIndex.xlEdgeLeft ).LineStyle
=Excel.XlLineStyle.xlContinuous;
excelWorkbook.Save();
excelWorkbook.Close(Type.Missing,workbookpath,Type.Missing);
export.DestinationOptions = ex;
excelWorkbook = null;
excelSheets = null;
excelApp = null;
When I use the above code, the Excel application is running in the
background (I'm able to see the process running for that in the Task Manager)
under IUSR_<servername> and as well as under current user who as logged into
the terminal. So whenever I export data, that many times the Excel
Application are running in the process.
How to solve this problem? Pls help me out...