Convert html to html

Hi,

I am actually looking for a way to convert HTML templates to HTML output again. I was wondering if this kind of conversion is possible using Aspose.Words?

Thanks for your help!

@JennyMa Sure, you can use Aspose.Words to open HTML document, modify the document and then save back to HTML or to any of the supported document formats.
But you should note that Aspose.Words is designed to work with MS Word documents and that why HTML document is read into Aspose.Words Document Object Model which differs from HTML structure. This might lead into difference between the input nd output HTML documents.

Thanks a lot for your fast answer!

I have just one more question: can I also use the LINQ Reporting Engine on HTML templates? I mean, can I create an HTML document with the given template syntax and use the Engine to get the tags replaced dynamically with data?
Or does the LINQ Reporting Engine only work on DOCX documents and the like?

Thank you!

@JennyMa Sure, you can define LINQ syntax in your HTML template. LINQ syntax is defined with regular text, so you can define it in any format, even in TXT.

@alexey.noskov Thanks again for your fast answer!

Still, I have one more question on the topic. I tried to use the LINQ Reporting Engine on the following HTML template:

<!DOCTYPE html>
<html>
<body>
<<[FirstName]>>
<<if [0!=0]>>Text<</if>>
</body>
</html>

The <<[FirstName]>> tag gets generated alright and is replaced by the dynamic value I am providing in my Java file.
The <<if [0!=0]>>Text<</if>> tag, on the other hand, does not work at all. The output of the template after using the LINQ Reporting engine on it and saving it again as HTML is the following:
output.png (2.0 KB)

Is it possible that the Conditional Blocks of the LINQ Reporting Engine Syntax do not work on HTML templates?

Thank you!

@JennyMa You should escape '<' and '>' characters in your HTML:

<!DOCTYPE html>
<html>
<body>
    &lt;&lt;[FirstName]&gt;&gt;
    &lt;&lt;if [0!=0]>>Text&lt;&lt;/if&gt;&gt;
</body>
</html>

@alexey.noskov Thank you very much, this works and solved my problem!

1 Like