Meine Beispiel-HTML-Datei sieht wie folgt aus:-
Code: Select all
table.main {
width: 700px;
height: 450px;
background: radial-gradient(#1367AB 0%, #154075 60%);
}
td.firsttablerow1 {
width: 190px;
}
td.firsttablerow2 {
width: auto;
color: white;
}
tr.image1 {
margin: "15px,20px,30px,40px";
align-items: stretch;
height: 100px;
}
tr.image2 {
margin: "0px,20px,30px,40px";
align-items: stretch;
}
tr.text1 {
color: #DDE9F2;
align-items: flex-end;
font-size: 9;
}
[img]C:\Jellyfish.jpg[/img]
[img]C:\Desert.jpg[/img]
"abc"
"xyz"
Mein C#-Code zum Konvertieren von HTML in Word ist wie gezeigt unten.
Code: Select all
MSWord.Application word = new MSWord.Application { Visible = false };
word.Documents.Open("htmlfilename", Format: WdOpenFormat.wdOpenFormatWebPages);
MSWord.Document doc = word.Documents[@"htmlfilename"];
doc.SaveAs2(@"wordFileName", WdSaveFormat.wdFormatDocument);
doc.Close();
doc = null;
word.Quit();
word = null;