Dear Support,
This is request from Sai Kiran Chebiyyam saikiranchebiyyam@newgensoft.com:
As you are aware, we are currently evaluating the 30-day trial version of Aspose Words for Java. We attempted to generate documents using the trial license; however, we are still encountering limitations that prevent the full document from being generated. A screenshot of the issue is provided below for your reference.
This restriction is preventing us from verifying whether the output meets our requirements.
Kindly advise on how to proceed. We look forward to your prompt response.
We are generating a html and renaming the html to .doc. We want to keep the .doc as such. We want to convert the .doc to .docx file using aspose words java. The conversion should ensure the .docx is same as doc. Currently the conversion is happening but the font is not getting set uniformly as font size 8. Attached the temp license, doc docs html and java src for setting the font uniformly to 8 for reference.
Please support and if confirmed we shall proceed with the procurement of the license.
test (2).zip (22.4 KB)
@alexey.butalov
Summary
The “Evaluation Note” appears because a trial license is being used; the trial adds a watermark and enforces usage limits. To obtain a clean, unrestricted document you must load a valid commercial license.
The loss of font size when you rename an HTML file to .doc and then save it as .docx occurs because Aspose Words treats the file as a Word document, not as HTML, so any CSS‑based font information is ignored and the library falls back to its default font size (typically 8 pt). Loading the source as HTML and, if needed, applying a uniform font size programmatically resolves the issue.
Why it happens
| Situation |
Root cause |
| Evaluation watermark is added |
The trial license deliberately limits functionality and inserts a “Generated by Aspose.Words for Java – Evaluation Version” watermark. |
| Renamed .html → .doc loses font size when saved as .docx |
Renaming does not change the file format. Aspose Words loads the file as a Word document, so CSS font specifications are ignored and the default font size is used. |
| Desired uniform font size is not applied |
No explicit font size is set on the document’s runs/paragraphs after loading, so the default size remains. |
What to do next
- Load a commercial license before any Aspose Words call
import com.aspose.words.License;
public class LicenseHelper {
public static void setLicense() throws Exception {
License lic = new License();
// Provide the path to your .lic file (absolute or relative to classpath)
lic.setLicense("Aspose.WordsforJava.lic");
}
}
Invoke LicenseHelper.setLicense(); as the first statement in your application.
- Load the original HTML file (do not rely on the .doc extension)
import com.aspose.words.*;
public class HtmlToDocx {
public static void main(String[] args) throws Exception {
LicenseHelper.setLicense();
// Load HTML with proper options so CSS is respected
HtmlLoadOptions loadOptions = new HtmlLoadOptions();
// If the HTML references external resources, set the base folder:
// loadOptions.setBaseUri("file:///C:/path/to/html/folder/");
Document doc = new Document("input.html", loadOptions);
// Apply a uniform font size if required
setUniformFontSize(doc, 8);
// Save as DOCX
doc.save("output.docx", SaveFormat.DOCX);
}
private static void setUniformFontSize(Document doc, double size) {
for (Paragraph para : (Iterable<Paragraph>) doc.getChildNodes(NodeType.PARAGRAPH, true)) {
for (Run run : (Iterable<Run>) para.getChildNodes(NodeType.RUN, true)) {
run.getFont().setSize(size);
}
}
}
}
- If you must keep the .doc extension for legacy reasons
Option A: Load the file as HTML using the code in step 2 (just point the Document constructor at the .doc file).
Option B: Force HTML parsing with LoadOptions:
LoadOptions opts = new LoadOptions();
opts.setLoadFormat(LoadFormat.HTML); // Treat the file as HTML regardless of extension
Document doc = new Document("renamed.doc", opts);
- Validate the output
- Open
output.docx in Microsoft Word.
- Verify that the evaluation watermark is absent.
- Check that the font size of paragraphs/runs matches the size you set (e.g., 8 pt).
- If the watermark persists after applying the license
- Confirm that the
.lic file is the correct one issued to you.
- Ensure the file path is reachable by the Java process (no permission issues).
- Optionally, call
lic.isLicensed() after setLicense(); it should return true.
- Proceed to production
- Deploy the same license file to your production environment.
- Repeat step 1 at application startup to guarantee the license is active for all subsequent operations.
These steps should eliminate the evaluation watermark and preserve (or enforce) the desired font size when converting HTML‑derived documents to DOCX. If further issues arise—such as missing CSS, images, or specific font substitution concerns—provide a minimal reproducible example so the problem can be examined in more detail.
@alexey.butalov The provided code looks correct. I tested it on my side and there are no evaluation version restrictions on my side. Please check the following points on your side:
- Make sure your call to
SetLicense gets executed. Step through in the debugger.
- Make sure your code does not catch an exception thrown by Aspose.Words licensing code. For example, Aspose.Words will throw if it cannot find the license.
- Make sure the input documents do not already have the evaluation message. Aspose.Words does not delete existing evaluation messages.
- Make sure
SetLicense is executed before you instantiate any Document object.