Displaying Excell

I am trying to display a excel document in a windows form using c#. My plan is to convert and xlsx document into either html or pdf and then display it either through Aspose's editor control (as html) or through the webbrowsercontrol (as pdf). I want to read a excel file into a filestream convert it to html and then display the html through the editor. Can anyone guide me through how to do this.

Hi,

Well, we have recently introduced the feature in the new version of GridDesktop i.e…, Importing / Exporting Xlsx files: File Format APIs for .NET Core, Java, Python, C++, Android | products.aspose.com I think you need to utilize two components i.e…, Aspose.Grid.Desktop and Aspose.Cells for .NET for your task. You may utilize Aspose.Grid.Desktop to open/view the xlsx file to the control and then use Aspose.Cells for .NET to convert the file to html and pdf formats as Aspose.Cells for .NET supports these features.

To open the file into GridDesktop, see the code below:

//Opening MS Excel 2007 Xlsx file specifying its path gridDesktop1.ImportExcelFile(“D:\test\book1.xlsx”, FileFormatType.Excel2007Xlsx);

To convert the xlsx file to pdf, please check the doc topic and codes for your reference:

http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/converting-to-pdf-files-net.html

//Instantiate the Workbook object

Workbook workbook = new Workbook();

//Open an excel file

workbook.Open("f:\\test\\Book1.xlsx");

//Save the document in Pdf format

workbook.Save("f:\\test\\outBook1.pdf", FileFormatType.Pdf);

//Save the document to html format

workbook.Save("f:\\test\\outBook1.html", FileFormatType.Html);

Getting file into stream

//Get an excel file path in a variable.
string path = @"f:\test\Book1.xlsx";
FileStream fs = File.OpenRead(path);

Aspose.Cells.Workbook workbook = new Workbook();
workbook.Open(stream, FileFormatType.Excel2007Xlsx);

//Save the document in Pdf format
workbook.Save("f:\\test\\outBook1.pdf", FileFormatType.Pdf);

//Save the document to html format
workbook.Save("f:\\test\\outBook1.html", FileFormatType.Html);

Thank you.

The gridDesktop1.ImportExcelFile claims that I have invalid arguments when doing this. The paramters include (string filePath), (Stream stream), or (string filePath, bool runFormulas). It does not accept a fileFormatType. And When I save a excel file as a html file into the stream and try to display the stream into the Aspose.editor control, I get the source code but not a view of the file.

Hi,

Well, for your info, FileFormatType is a new API of Aspose.Grid.Desktop, so you should use our latest version (v2.0.1): http://www.aspose.com/community/files/53/visual-components/aspose.grid-for-.net/entry174314.aspx

For Aspose.Editor control, I am not sure about it. So, kindly do contact Aspose.Editor team in its forum: http://www.aspose.com/community/forums/aspose.editor-for-.net/263/showforum.aspx So one of our colleagues will help you soon.

Thank you.

Is there any reason why the desktop grid control will not display images that are embedded in a pdf file?

Hi,

Well, I am afraid images are not imported with the file contents to griddesktop control. We will support this feature in future versions.

Thank you.