We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Template (Excel) file problem

Thread ID:

Created:

Updated:

Platform:

Replies:

23338 Jan 10,2005 05:49 AM Jan 11,2005 10:37 PM Windows Forms 1
loading
Tags: XlsIO
Mohammad Abdullah
Asked On January 10, 2005 05:49 AM

Hi , I write the following code to set the file as template : ExcelEngine excelEngine = new ExcelEngine(); IApplication application = excelEngine.Excel; IWorkbook myWorkbook = ExcelUtils.CreateWorkBookUsingTemplate (Application.StartupPath + @"\\repCpxFormat.xls"); IWorksheet SheetAll = myWorkbook.Worksheets[0]; IWorksheet SheetInfo = myWorkbook.Worksheets[1]; IWorksheet SheetBuild = myWorkbook.Worksheets[2]; It gives me the following error on the line that said (ExcelUtils.CreateWorkBookUsingTemplate...etc): ---- system.argumentoutofrangeexception , The specified argument was out of valid values parameter name reading order. --- Please Note: 1-I''m sure about the file name and the location available at the application path. 2-The number of worksheets is 3. The strange thing that I did the same code with another Excel files in another part of the application without any error problems and here is an examples (Error free) : ----- ExcelEngine excelEngine = new ExcelEngine(); IApplication application = excelEngine.Excel; //A new workbook is created.[Equivalent to creating a new workbook in MS Excel] // The number of default worksheets is the IWorkbook myWorkbook=ExcelUtils.CreateWorkBookUsingTemplate (Application.StartupPath + @"\\repbldgFormat.xls"); //The first worksheet object in the worksheets collection is accessed. IWorksheet SheetAll = myWorkbook.Worksheets[0]; IWorksheet SheetInfo = myWorkbook.Worksheets[1]; --- ExcelEngine excelEngine = new ExcelEngine(); IApplication application = excelEngine.Excel; //A new workbook is created.[Equivalent to creating a new workbook in MS Excel] // The number of default worksheets is the application setting in MS Excel. IWorkbook myWorkbook = ExcelUtils.CreateWorkBookUsingTemplate (Application.StartupPath + @"\\reptDepFormat.xls"); /The first worksheet object in the worksheets collection is accessed. IWorksheet SheetAll = myWorkbook.Worksheets[0]; IWorksheet SheetInfo = myWorkbook.Worksheets[1]; Thank you

Administrator [Syncfusion]
Replied On January 11, 2005 10:37 PM

Hi Mohammad, Could you please upload the template file in your Direc-Trac incident. Thanks. Best regards, Stephen. >Hi , > I write the following code to set the file as template : >ExcelEngine excelEngine = new ExcelEngine(); >IApplication application = excelEngine.Excel; >IWorkbook myWorkbook = ExcelUtils.CreateWorkBookUsingTemplate (Application.StartupPath + @"\\repCpxFormat.xls"); >IWorksheet SheetAll = myWorkbook.Worksheets[0]; >IWorksheet SheetInfo = myWorkbook.Worksheets[1]; >IWorksheet SheetBuild = myWorkbook.Worksheets[2]; >It gives me the following error on the line that said (ExcelUtils.CreateWorkBookUsingTemplate...etc): >---- >system.argumentoutofrangeexception , The specified argument was out of valid values parameter name reading order. >--- >Please Note: >1-I''m sure about the file name and the location available at the application path. >2-The number of worksheets is 3. > >The strange thing that I did the same code with another Excel files in another part of the application without any error problems and here is an examples (Error free) : >----- >ExcelEngine excelEngine = new ExcelEngine(); >IApplication application = excelEngine.Excel; >//A new workbook is created.[Equivalent to creating a new workbook in MS Excel] >// The number of default worksheets is the >IWorkbook myWorkbook=ExcelUtils.CreateWorkBookUsingTemplate (Application.StartupPath + @"\\repbldgFormat.xls"); >//The first worksheet object in the worksheets collection is accessed. >IWorksheet SheetAll = myWorkbook.Worksheets[0]; >IWorksheet SheetInfo = myWorkbook.Worksheets[1]; >--- >ExcelEngine excelEngine = new ExcelEngine(); >IApplication application = excelEngine.Excel; >//A new workbook is created.[Equivalent to creating a new workbook in MS Excel] >// The number of default worksheets is the application setting in MS Excel. >IWorkbook myWorkbook = ExcelUtils.CreateWorkBookUsingTemplate (Application.StartupPath + @"\\reptDepFormat.xls"); >/The first worksheet object in the worksheets collection is accessed. >IWorksheet SheetAll = myWorkbook.Worksheets[0]; >IWorksheet SheetInfo = myWorkbook.Worksheets[1]; > >Thank you > >

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;