View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Fredrik Wahlgren Fredrik Wahlgren is offline
external usenet poster
 
Posts: 339
Default Open XML string in Excel using C#


"Stefani" wrote in message
...
Hi,

I've seen both documentation references before and neither address my
situation. I'm starting to get very frustrated with Mr. Gates. Why is
complete documentation so difficult to find???

Any who...Here's what I'm trying to do:

1) First I'd like a way to programmatically create a workbook then stuff

an
XML string into it then open the workbook in XML. What I've found is only

a
way to create a workbook then cell by cell populate it then open it. The
other option to save the XML string in a .xml file first then open that
saved file in Excel is not really a great option for me. So if you can
point me to some documentation that might show me how do this it would be
great.

2) Now if there is no way to do #1 and I have to save the XML in a file
first then open in Excel, I have another question. When you open an .xml
with Excel, you are prompted with: "Open XML - as XML list, as workbook,

use
the XML Source task pane?" What I'd like to do is programmatically tell
Excel to open the file "as XML list". Excel should open XML source

creating
a default schema since one wasn't specified.

The method I'm using to open the .xml file is

excelApp.Workbooks.OpenXML(fileName, Type.Missing);

The second parameter is a Stylesheet. Since the XML is data based on a

SQL
query, I don't know enough in advance to provide a matching Stylesheet. I
was hoping that when Excel opens the User would be provided the same

prompt
as if she opened the file directly with Excel.

I was also hoping that .OpenXML would have overload where how the file is
open could be provided.


If you could point me to any documentation you'd be a lifesaver.

Thanks,

Stefani


According to this article, you should omit the the value for the second
parameter. I'm not sure you can do that, you use some .NET language, right?
http://support.microsoft.com/default...b;en-us;307230

/Fredrik