Can I use aspose to open an excel window using C#?


#1

Hi,
I’ve created an aspose excel object and at the moment I can save it to an excel format using:

excel1.Save(@“C:\Visual Studio Projects\Test.xls”);


I want to know can I actually open windows Excel with the file from the C# code?
I know there is an Open function but am I correct in saying that only opens a data stream?

#2

Please try this:

ProcessStartInfo psi = new ProcessStartInfo((@“C:\Visual Studio\Projects\Test.xls”);

Process.Start(psi);


#3

Hey,
Thats throwing up a type/namespace error, what namespace do I need to add for Process/Process StartInfo?


#4

Please refer to your MSDN. You can find:

System.Diagnostics.ProcessStartInfo
System.Diagnostics.Process


#5

Apologies I thought the functions were a part of aspose, yep thats working perfectly now thanks!


#6

Hi,
I’ve a little add on to this query I had a while back…

It turns out I don’t actually need to save the Aspose Excel object, after I’m done populating it I just need to open it in an MS Excel window.

Seeing as the code:
ProcessStartInfo psi = new ProcessStartInfo((@“C:\Visual Studio\Projects\Test.xls”);

requires having a saved file to open I’m just wondering is there any way I can open the Aspose Excel object in an MS Excel window without saving it to a file?


#7

Aspose.Excel can save result to memory stream but I also don’t know how to pass the data to MS Excel without saving it to disk.


#8

Did you try this?

excel1.Save(“test.xls”, SaveType.OpenInPlace, FileFormatType.Default, Response);


#9

If your application is a webform application, you can use

excel1.Save(“test.xls”, SaveType.OpenInExcel, FileFormatType.Default, Response);

to open an Excel window without saving the file to disk.

However, if your app is a winform app, I think you have to save it to disk before using MS Excel to open it.