As the title says, I try to actually paste what is in my Clipboard into an Excel.
I've following code:
Clipboard.SetText(html);
sheet.Range("A1").Value = Clipboard.GetText();
Actually, the variable html contains a html code file, when I do it like that, I actually paste only the html content into the Range, but, if I open Excel and do by hand, Paste Special... I can paste the html code, but it transforms the code into a real table instead of a html code and this is the real result that I want, without doing it by hand.
Excel.Range.Copy() paste with Clipboard.GetText()
Another way was:
foreach (Excel.Worksheet sheet in workbook.Sheets)
{
foreach (Excel.Shape shape in sheet.Shapes)
{
Clipboard.SetText(html);
//doesn't work:
sheet.Range("A1").Value = sheet.PasteSpecial(Clipboard.GetText());
sheet.PasteSpecial(Clipboard.GetText()); //throws error
}
}
But this way doesn't work too. I can do it with an html -> image and paste the image, but real values should be accessible and not a picture.
Hope someone can clarify how to solve it.
Thanks.