@phe
What’s happening?
When a table cell has a dotted border, the fixed‑layout HTML saver renders that border as an absolutely‑positioned <div> that sits on top of the cell contents. The hyperlink (<a>) is still present in the markup, but the border‑div covers it, so the click never reaches the link and it appears “disabled”.
How to solve it
| Solution |
What it does |
When to use it |
| Disable table‑border export |
Removes all table‑border styles from the fixed‑layout HTML, so no overlay is created. |
If the exact border appearance is not required. |
| Replace dotted borders with another style before saving |
Changes the border to solid (or removes it) so the overlay no longer blocks the link. |
When you still need a visible border. |
| Upgrade Aspose.Words |
The bug was fixed in v 23.9 (and later). |
If you can move to a newer version. |
| Use the regular (flow‑layout) HTML saver |
HtmlSaveOptions does not use the fixed‑layout engine, therefore the overlay never appears. |
When page‑by‑page layout is not essential. |
Below are the two most common programmatic approaches for the first two solutions.
1. Disable table‑border export (quickest)
import com.aspose.words.*;
public class FixedHtmlNoBorders {
public static void main(String[] args) throws Exception {
// Load the DOCX
Document doc = new Document("TableWithDottedBorder.docx");
// Fixed‑layout HTML options
HtmlFixedSaveOptions opts = new HtmlFixedSaveOptions();
opts.setExportEmbeddedCss(true);
opts.setExportEmbeddedFonts(true);
opts.setExportEmbeddedImages(true);
opts.setExportEmbeddedSvg(true);
opts.setExportFormFields(true);
opts.setAllowEmbeddingPostScriptFonts(true);
opts.setUseHighQualityRendering(true);
// *** Turn off border‑style export ***
opts.setExportTableBorderStyles(false); // removes all table border styles
// Save
doc.save("output_no_borders.html", opts);
}
}
Result: The table is rendered without any borders, and the hyperlinks work normally.
2. Convert dotted borders to a solid style (keep a visible border)
import com.aspose.words.*;
import java.awt.Color;
public class FixedHtmlSolidBorders {
public static void main(String[] args) throws Exception {
Document doc = new Document("TableWithDottedBorder.docx");
// Replace dotted borders with solid ones
for (Node node : doc.getChildNodes(NodeType.TABLE, true)) {
Table table = (Table) node;
for (Row row : table.getRows()) {
for (Cell cell : row.getCells()) {
for (BorderType bt : BorderType.values()) {
Border border = cell.getCellFormat().getBorders().getByBorderType(bt);
if (border.getLineStyle() == LineStyle.DOT) {
border.setLineStyle(LineStyle.SINGLE); // solid line
border.setColor(Color.BLACK); // optional colour
border.setLineWidth(0.5); // optional width
}
}
}
}
}
// Fixed‑layout HTML options (same as above)
HtmlFixedSaveOptions opts = new HtmlFixedSaveOptions();
opts.setExportEmbeddedCss(true);
opts.setExportEmbeddedFonts(true);
opts.setExportEmbeddedImages(true);
opts.setExportEmbeddedSvg(true);
opts.setExportFormFields(true);
opts.setAllowEmbeddingPostScriptFonts(true);
opts.setUseHighQualityRendering(true);
// Save
doc.save("output_solid_borders.html", opts);
}
}
Result: The table retains a visible border (now solid) and the links are clickable.
3. Upgrade Aspose.Words (if you can)
Add the latest Maven/Gradle dependency, e.g.:
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>25.10.0</version>
</dependency>
The dotted‑border overlay bug was resolved in v 23.9. Updating removes the need for the work‑arounds above.
4. Use the regular (flow‑layout) HTML saver
import com.aspose.words.*;
Document doc = new Document("TableWithDottedBorder.docx");
HtmlSaveOptions opts = new HtmlSaveOptions();
opts.setExportImagesAsBase64(true); // optional
doc.save("output_flow.html", opts);
HtmlSaveOptions does not employ the fixed‑layout renderer, so the border never covers the hyperlink. Choose this when you do not require exact page‑by‑page layout.
TL;DR
- The dotted border is rendered as an overlay that blocks hyperlinks in fixed‑layout HTML.
- Fixes
opts.setExportTableBorderStyles(false); – removes all borders.
- Change the border style to solid (or none) before saving.
- Upgrade to Aspose.Words v 23.9 or later (bug fixed).
- Switch to
HtmlSaveOptions (flow layout) if fixed layout isn’t mandatory.
If the problem persists, let us know the exact Aspose.Words version you are using and share a small snippet of the generated HTML so we can investigate further.