We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Export Html string to Worksheet

Hi,

I am using Aspose Cells, Do we have feasibility to html string to worksheets, as I have mulitple html strings which I need to convert to work sheets.

I have code which will convert html to workbook, but I am looking limilar to worksheet

byte[] byteArray = Encoding.ASCII.GetBytes(obj.htmlContent);
MemoryStream ms = new MemoryStream();
//using (MemoryStream stream = new MemoryStream(byteArray)) {
Aspose.Cells.LoadOptions lo = new Aspose.Cells.LoadOptions(Aspose.Cells.LoadFormat.Html);
Aspose.Cells.Workbook workBook = new Aspose.Cells.Workbook(stream, lo);
ms = workBook.SaveToStream();
workBook.Save(@“D:\excelTests\testop.xlsx”);
}

Thanks In advance.

Regards,
Nithin Eate

@NithinEate,

Thanks for sharing some details.

Well, we are not sure about your requirements. Please give us more details, a runnable sample to show what’s the trouble you are getting. Also, elaborate what you want to get or achieve?

It looks like your “htmlContent” is not the file content with standard html file format. Please give us your desired output which you may manually create. Also give us steps on how to accomplish the task in Ms Excel manually. This will help us evaluate your requirement and we will be in better position to comment on it.

Hi Amjad,

I have a html tables. I want to convert all these html tables to multiple worksheets in a excel file.

Whatever the html tables I want to convert to excel worksheets those should start with A6 cell and I want to insert some content like heading of the html table in A3 Cell.

Could you please help me out how can we achieve it using ASPOSE Cells C#

Thanks in advance

@NithinEate,

Well, if you could split your HTML tables into different standalone html files, then you can easily import them into different workbooks, and then copy the data from every sheet to the destination of final workbook (you may add blank sheets in the destination workbook and copy data from each source sheet).

Moreover, if you parse the tables by himself, then maybe you could use Cell.HtmlString or just set value to corresponding cells. We are still not sure the contents or formatting of your HTML file or tables. Please give it a try as our proposed suggestion (above). If you find any issue, do provide sample code, samples to show the issue. we will check it soon.

Hi Amjad,

Thanks for you suggestion which is worthy and it worked well.

@NithinEate,

Good to know that your issue is sorted out by the suggested approach/workaround. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.