View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Excel 2007 insert HTML with images Excel 2007 insert HTML with images is offline
external usenet poster
 
Posts: 1
Default 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?