Browse Source

REPORT-33491 无插件PDF导出-HTML解析:支持<th>标签加粗样式

release/10.0
Hugh.C 5 years ago
parent
commit
ed07433555
  1. 1
      fine-itext-old/src/main/java/com/fr/third/com/lowagie/text/pdf/PdfGraphics2D.java
  2. 3
      fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/HTMLWorker.java
  3. 4
      fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/IncCell.java

1
fine-itext-old/src/main/java/com/fr/third/com/lowagie/text/pdf/PdfGraphics2D.java

@ -433,6 +433,7 @@ public class PdfGraphics2D extends Graphics2D {
cb.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE); cb.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE);
if (strokeWidth != 1) { if (strokeWidth != 1) {
cb.setLineWidth(strokeWidth); cb.setLineWidth(strokeWidth);
oldStroke = new BasicStroke(strokeWidth);
if(realPaint instanceof Color){ if(realPaint instanceof Color){
Color color = (Color)realPaint; Color color = (Color)realPaint;
int alpha = color.getAlpha(); int alpha = color.getAlpha();

3
fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/HTMLWorker.java

@ -491,6 +491,9 @@ public class HTMLWorker implements SimpleXMLDocHandler, DocListener {
endElement(tag); endElement(tag);
skipText = false; skipText = false;
pendingTD = true; pendingTD = true;
if (tag.equals("th")) {
h.put("b", null);
}
cprops.addToChain("td", h); cprops.addToChain("td", h);
stack.push(new IncCell(tag, cprops)); stack.push(new IncCell(tag, cprops));
return; return;

4
fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/IncCell.java

@ -74,8 +74,8 @@ public class IncCell implements TextElementArray {
if (value != null) if (value != null)
cell.setColspan(Integer.parseInt(value)); cell.setColspan(Integer.parseInt(value));
value = props.getProperty("align"); value = props.getProperty("align");
if (tag.equals("th")) // if (tag.equals("th"))
cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setHorizontalAlignment(Element.ALIGN_CENTER);
if (value != null) { if (value != null) {
if ("center".equalsIgnoreCase(value)) if ("center".equalsIgnoreCase(value))
cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setHorizontalAlignment(Element.ALIGN_CENTER);

Loading…
Cancel
Save