Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm writing an app to take an XML doc and turn it into a spreadsheet. I've
got it working with one section of the XML, but am getting "Exception from HRESULT: 0x800A03EC" as another section is being inserted. The process is to take the XML, convert it to a text file, convert the text to an array, and insert the array as a dataset: Excel.Application tds = new Excel.Application(); Excel.Workbooks tdsWorkBooks = (Excel.Workbooks)tds.Workbooks; Excel.Workbook tdsWorkBook = tds.Workbooks.Add(Excel.XlWBATemplate.xlWBATWorksh eet); using (StreamWriter sw = new StreamWriter(filePath)) { //Create the text file } Excel.Sheets tdsSheets = tdsWorkBook.Sheets; Excel.Worksheet tdsWorkSheet = (Excel.Worksheet)tdsSheets.Add(tdsSheets[1], Type.Missing, Type.Missing, Type.Missing); object[,] tdsData = new Object[rows, 7]; //Convert the text to an array using (StreamReader sr = new StreamReader(filePath)) { int r = 0; while ((tdsBuildArray = sr.ReadLine()) != null && r < rows) { string[] idArray = tdsBuildArray.Split("|".ToCharArray()); tdsData[r, 0] = idArray[0]; tdsData[r, 1] = idArray[1]; tdsData[r, 2] = idArray[2]; tdsData[r, 3] = idArray[3]; tdsData[r, 4] = idArray[4]; tdsData[r, 5] = idArray[5]; tdsData[r, 6] = idArray[6]; r++; } } string iRange = "G" + rows.ToString(); //Insert the array as a dataset. This is where the break occurs Excel.Range tdsRange = tdsWorkSheet.get_Range("A1", iRange); tdsRange.set_Value(Type.Missing, tdsData); tdsWorkSheet.Name = "Edit Specifications"; tdsWorkSheet = null; tds.Quit(); I would appreciate any suggestions as to how to correct this issue. Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Exception from HRESULT: 0x800A03EC at Excel.Workbooks.Open | Excel Programming | |||
Exception from HRESULT: 0x800A03EC when setting string in Range.Value2 field | Excel Programming | |||
Exception from HRESULT: 0x800A03EC while binding values to a range | Excel Programming | |||
Copy a worksheet throws "Exception from HRESULT: 0x800A03EC." | Excel Programming | |||
Chart.Export throws COMException (0x800A03EC): Exception from HRESULT: 0x800A03EC. | Excel Programming |