diff --git a/examples/Demo/Program.cs b/examples/Demo/Program.cs index 47c0124..0620d54 100644 --- a/examples/Demo/Program.cs +++ b/examples/Demo/Program.cs @@ -15,7 +15,7 @@ static class Program static async Task Main(string[] args) { const string filename = "test.docx"; - string html = ResourceHelper.GetString("Resources.AdvancedTable.html"); + string html = ResourceHelper.GetString("Resources.CompleteRunTest.html"); if (File.Exists(filename)) File.Delete(filename); using (MemoryStream generatedDocument = new MemoryStream()) @@ -28,8 +28,8 @@ static async Task Main(string[] args) } generatedDocument.Position = 0L; - using (WordprocessingDocument package = WordprocessingDocument.Open(generatedDocument, true)) - //using (WordprocessingDocument package = WordprocessingDocument.Create(generatedDocument, WordprocessingDocumentType.Document)) + //using (WordprocessingDocument package = WordprocessingDocument.Open(generatedDocument, true)) + using (WordprocessingDocument package = WordprocessingDocument.Create(generatedDocument, WordprocessingDocumentType.Document)) { MainDocumentPart mainPart = package.MainDocumentPart; if (mainPart == null) @@ -38,12 +38,11 @@ static async Task Main(string[] args) new Document(new Body()).Save(mainPart); } - HtmlConverter converter = new HtmlConverter(mainPart); + HtmlConverter converter = new(mainPart, new HtmlToOpenXml.IO.DefaultWebRequest(){ + BaseImageUrl = new Uri(Path.Combine(Environment.CurrentDirectory, "images")) + }); converter.RenderPreAsTable = true; - Body body = mainPart.Document.Body; - await converter.ParseBody(html); - mainPart.Document.Save(); AssertThatOpenXmlDocumentIsValid(package); } diff --git a/examples/Demo/Resources/Demo.html b/examples/Demo/Resources/Demo.html deleted file mode 100644 index 906b7e4..0000000 --- a/examples/Demo/Resources/Demo.html +++ /dev/null @@ -1,97 +0,0 @@ -
- If you like it, add me a rating on codeplex -
-public void SetContentType(System.Web.HttpRequest request, System.Web.HttpResponse response, String reportName)
-{
- if (request.Browser.Browser.Contains("IE"))
- {
- // Replace the %20 to obtain a clean name when saving the file from Word.
- encodedFilename =
- Uri.EscapeDataString(Path.GetFileNameWithoutExtension(encodedFilename)).Replace("%20", " ")
- + Path.GetExtension(encodedFilename);
- }
-}
-
-
-
- An ordered list:
-An unordered list:
-$#Candidate Code#$
--
saa | -fdgdfg | -fdg | -fdgfdg | -- |
- | - | - | fdg | -- |
- | fd | -fdggfdg | -- | gfdgfd | -
saa | -fdgdfg | -fdg | -fdgfdg | -- |
- | - | - | fdg | -- |
- | fd | -fdggfdg | -- | gfdgfd | -