HighTechTalks DotNet Forums  

Re: int Data Type, Primitive or Not?

Dotnet VJSharp microsoft.public.dotnet.vjsharp


Discuss Re: int Data Type, Primitive or Not? in the Dotnet VJSharp forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Nate Laws
 
Posts: n/a

Default Re: int Data Type, Primitive or Not? - 08-11-2004 , 04:55 PM






Thanks for replying,

Quote:
Did you try this one ?
SeriesCollection.Item("1")
Yes

SeriesCollection sc =
(SeriesCollection)xlChart.SeriesCollection(Type.Mi ssing);
Series series = (Series)sc.Item("1") ;

Which causes a:

An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in mscorlib.dll

Additional information: Item method of SeriesCollection class failed

This tells me nothing.


Alternatively I have tried:
Series series = (Series)xlChart.SeriesCollection("1");

Which throws an exception with an HRESULT:

An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in ExcelTest.exe

Additional information: Exception from HRESULT: 0x800A03EC.


From what I could find on MSDN and Google, it appears that HRESULT
0x800A03EC is a pretty much useless.


My source code is:

private void set_up_and_do()
{
this.app = new Microsoft.Office.Interop.Excel.ApplicationClass();

this.work =
app.get_Workbooks().Open(System.Windows.Forms.Appl ication.get_StartupPath()+"\\default.xls",
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing);

xlSheet = (Worksheet)this.work.get_Worksheets().get_Item("Sh eet1");

write_system_headers(); //write column labels
write_system_labels(); //write row labels
write_arrays(); //write data arrays


Range rng = this.xlSheet.get_Range("D4","D"+j );//range where data was
written to

ChartObjects charts = (ChartObjects)xlSheet.ChartObjects(Type.Missing);
ChartObject chartObj = charts.Add(100,300,500,300);
Chart xlChart = chartObj.get_Chart();

xlChart.ChartWizard((Object)rng,(Object) Constants.xlColumn, Type.Missing,
(Object)XlRowCol.xlColumns,Type.Missing,Type.Missi ng, Type.Missing,
(Object)"Title", (Object)"Y Title", (Object)"X Title", (Object)"Extra
Title");

//get the series collection from the chart
SeriesCollection sc =
(SeriesCollection)xlChart.SeriesCollection(Type.Mi ssing);

//Series series = (Series)sc.Item( "1") ;
Series series = (Series)xlChart.SeriesCollection( "1");
}

It crashes on either of the last two lines.

btw, the Excel Microsoft.Office.Interop.Excel reference is for the
“Microsoft Excel 11.0 Object Library” version 1.5


From what I could glean from the few C# examples on Excel charts,
SeriesCollection() needs an integer object passed to it; and this is why I
asked my original question.

Might this be a flaw in the design of J#? I certainly hope that its just me
missing something simple.

Thanks,
Nate Laws


Reply With Quote
  #2  
Old   
Nate Laws
 
Posts: n/a

Default Re: int Data Type, Primitive or Not? - 08-13-2004 , 03:43 PM






Quote:
Please see this article for more info.
http://msdn.microsoft.com/library/de..._vstmultcr.asp
ah, the irony...
Actually I read that and ported the C# example code into my application
before I posted my second message.

However now that I think about it, I might have been checking/setting the
wrong CurrentThread and CurrentCulture.

Although, I don't really see how they could be anything besides "en-US".

I'll have to spend some more time looking into it.

Anyway, thanks for your help.
Nate Laws


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.