Created
July 16, 2020 08:23
-
-
Save jozefizso/12df9dd27dab16b76440ee95f1b21463 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<h4 itemprop="content rn_title">H4 Title</h4> | |
<div itemprop="content"> | |
<p>Sample content....</p> | |
<div class="infomalfigure"> | |
<div class="mediaobject"> | |
<p>Image...</p> | |
<p><img src="NetOfficeLogo_200x200.png"></p> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var timestamp = DateTime.Now.ToFileTimeUtc(); | |
var filename = $@"Doc_{timestamp}.docx"; | |
try | |
{ | |
var app = new Application(); | |
var doc = app.Documents.Add(); | |
doc.Content.InsertAfter("Hello world."); | |
doc.Content.InsertFile(@"code.html"); | |
doc.SaveAs(filename); | |
app.Quit(); | |
} | |
catch (Exception ex) | |
{ | |
Console.WriteLine($"Error: {ex}"); | |
} | |
Console.WriteLine($"File: {filename}"); | |
Console.WriteLine("Done."); | |
Console.ReadKey(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment