Excel 2007 insert HTML with images

  • Thread starter Excel 2007 insert HTML with images
  • Start date
E

Excel 2007 insert HTML with images

Hi2all!

I want add to active Worksheet content of 1 HTML file, which consist of
paragraphs, tables and images. I use the following code to do this:

public void InsertHTML()
{
object connection = @"URL;C:\html\test_html.html";
Range curRange = (Range)this.Application.Selection;
Worksheet curSheet = (Worksheet)this.Application.ActiveSheet;
QueryTable tblQuery = curSheet.QueryTables.Add(connection, curRange, missing);
tblQuery.BackgroundQuery = true;
tblQuery.TablesOnlyFromHTML = false;
tblQuery.Refresh(false);
tblQuery.SaveData = true;
tblQuery.Delete();
}

And I have 2 problems:
1) no images from source 'test_html.html' file is inserted into worksheet;
2) no table column width is derived from source file

But when I press Ctrl+O from Excel and open this HTML file, all images and
table styles import correctly! How I can get the same in my VSTO add-in?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top