Free Support Forum -

HtML Inport into Excel

Is it possible to import an html string into the Aspose’s excel worksheet so it is subsequently saved in the excel file as a workseet?

HTML import feature is not support in Aspose.Excel now. We will implement this feature in the future. It will take about several months to implement this feature.

That’s funny, that is exactly what you said in one of the threads on the topic posted two years ago in 2003.

Can you suggest a way to import text into Aspose’s worksheet and save it in the excel file.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Hi Roman,

We did plan to implement html import/export feature before but we postponed this work for we found it’s too complex and we had many other urgent feature requests on hand.

Now we implement xls2asposepdfxml feature and are working on xls2spreadsheetml feature. When the xls2spreadsheetml is completed, we will start to do xls2html and html2xls feature. So html import/export feature will started in about one or two weeks.

Now to import text into Aspose’s worksheet, you can try the following:

1. Convert the file to CSV file and use Excel.OpenCSV method to import it.

2. Process the txt file by your own code and use Cell.PutValue(string) method to put strings to cells in worksheet.

I need to have one regular worksheet with the cells (table) and the other a worksheet with the text, such as csv. Will I be able to do it if I open the Excel with OpenCSV, Excel.OpenCSV ?

I don’t clearly understand your need. Could you elaborate it?

If you use Excel.Open method to open a csv file, Aspose.Excel will import it to Aspose.Excel object model. You can save the whole file as Excel file or as CSV file. But you cannot save a worksheet as Excel file and another worksheet as CSV file now.

Sorry for the confusion. I have to create an excel object with two worksheets; one worksheet consisting a table another working consisting the csv. I would import a DataTable into one worksheet, and import csv (I am not sure how to do it) into the other worksheet. Then, I need to save the excel into an excel file. So, the new file has two worksheets; one with the table and the other with the csv.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

1. You can use Excel.OpenCSV to import a csv file to the first worksheet.
2. You can use Cells.ImportDataTable to import a DataTable to another workshee.
3. Then you can save the result into an Excel file.

The OpenCSV call confuses me. I have a design file that I have to use. The design file is for the macros. So, I can’t open csv. Yet, once I open the excel with the design file I need to add one worksheet and import a table and another worksheet and import cvs. The cvs is represented as a string and not as a file.<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><o:p></o:p>

If your csv is a string and not a file, you can try this:

//inputCSV is the csv string
string[] rows = inputCSV.Split('\n');

for(int i = 0; i < rows.Length; i ++)
cells.ImportArray(rowsIdea.Split(','), i, 0, false);