Skip to content

Instantly share code, notes, and snippets.

@jozefizso
Created July 16, 2020 08:23
Show Gist options
  • Save jozefizso/12df9dd27dab16b76440ee95f1b21463 to your computer and use it in GitHub Desktop.
Save jozefizso/12df9dd27dab16b76440ee95f1b21463 to your computer and use it in GitHub Desktop.
<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>
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