Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hello , does any one have this problem?
In Excel , the exception throw above system.Runtime.InteropServices.COMException (0x80020005): Type mismatch. see http://forums.microsoft.com/MSDN/Sho...98970&SiteID=1 this threat have been took care for office 2003 system. it is adolutely working fine. but it have been a issue in office 2007 system. /// Set individual cell in a workspace into the value /// </summary void SetValue( int r, int c, string s, bool bBold ) { if( s!= "" ) ((Excel.Range)this.Sheet.Cells[r, c ]).FormulaR1C1= s; ((Excel.Range)this.Sheet.Cells[r, c ]).Font.Bold= bBold; } /// <summary /// Set individual cell in a workspace into the value /// </summary string GetValue( int r, int c ) { return ((Excel.Range)this.Sheet.Cells[r, c ]).Value2.ToString(); } /// <summary /// Assign a range with the bold /// </summary void SetBold( int r, int r1, bool b ) { ((Excel.Range)this.Sheet.get_Range( this.Sheet.Cells[r,1], this.Sheet.Cells[r1+1,1] )).Font.Bold= b; ------------------- void ClearAll() { int i= YOFFS; Excel.Range cAll= (Excel.Range)this.Sheet.Rows[ i.ToString()+ ":65535", Type.Missing ]; try { cAll.Rows.Ungroup(); cAll.Rows.Ungroup(); cAll.Rows.Ungroup(); } catch { } cAll.ClearContents(); cAll.Interior.ColorIndex= Excel.XlColorIndex.xlColorIndexNone; cAll.Font.Bold= false; cAll.Locked= true; cAll= (Excel.Range)this.Sheet.Columns[ "A:IV", Type.Missing ]; try { cAll.Columns.Ungroup(); cAll.Columns.Ungroup(); cAll.Columns.Ungroup(); } catch {} this.Sheet.Application.ActiveWindow.FreezePanes= false; // Change default groupping behavior this.Sheet.Outline.AutomaticStyles= false; this.Sheet.Outline.SummaryRow= Excel.XlSummaryRow.xlSummaryAbove; this.Sheet.Outline.SummaryColumn= Excel.XlSummaryColumn.xlSummaryOnRight; } // ------------------------------------------------------------------------------ /// <summary /// Put all the bases into the worksheet and update the dropdown /// </summary protected void UpdateBase() {//Added the try catch block to capture if any error occurs while displaying the splash screen - Sreejesh try { DataSet cDs= this.cService.GetBaseProducts(this.App.UserName, this.DMP_APP_NAME, DMP_MAIN_FORM ); int x= 1; // Put bases data into the worksheet //MessageBox.Show( "Before Foreach" ); //Sreejesh foreach( DataRow r in cDs.Tables[0].Rows ) { ((Excel.Range)this.Sheet.Cells[ x, 1 ]).Value2= r[1]; ((Excel.Range)this.Sheet.Cells[ x++, 2 ]).Value2= r[0]; } //MessageBox.Show( "After foreach" ); //Sreejesh // Create dropdown Excel.Validation cVal= ((Excel.Range)this.Sheet.Cells[YOFFS - 2, 2]).Validation; cVal.Delete(); string s= "=A1:A" + (x-1).ToString(); //MessageBox.Show( "aFTER Cval" ); //Sreejesh cVal.Add( Excel.XlDVType.xlValidateList, Excel.XlDVAlertStyle.xlValidAlertStop, Excel.XlFormatConditionOperator.xlBetween, s, "" ); cVal.IgnoreBlank = false; cVal.InCellDropdown = true; cVal.InputTitle = ""; cVal.ErrorTitle = ""; cVal.InputMessage = ""; cVal.ErrorMessage = ""; cVal.ShowInput = true; cVal.ShowError = true; } catch(Exception e) { throw e; } } // ------------------------------------------------------------------------------ see this code above , there is adsulotely work fine for office 2003. but not office 2k7 : when we migrating a previous Excel xls project call to the com objects for each task, in upgrade to office 2007, using Vsto by C#, we change out some the template's cs, code for comptible to office 2007 , in the scope of: sheet. column object, column's max size -- in sheet .Column range from (AA:ZZ) to (A:IV) cAll= (Excel.Range)this.Sheet.Columns[ "A:IV", Type.Missing ]; b/c office 2007 is change to IV. then the column cell is not creating in design time of the project runing , there is a exception throw : system.Runtime.InteropServices.COMException (0x80020005): Type mismatch. we not yet know how to .. have any one got that ? any suggetion? you help are highly appreciated. Chan thanks pinky |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sheet.columns(aa:zz) ,COMException (0x80020005) VSTO Formatting is | Excel Discussion (Misc queries) | |||
COMException on InvokeMember | Excel Programming | |||
getting System.Runtime.InteropServices.COMException | Excel Programming | |||
System.Runtime.InteropServices.COMException (0x800A03EC) | Excel Programming | |||
System.Runtime.InteropServices.COMException (0x80020005) in excel 2k7, but worked well in 2k3 | Excel Programming |