From 1e6c2d5271019cbd6716d156fb14b67bb0e739c5 Mon Sep 17 00:00:00 2001 From: Sergey Vladimirov Date: Thu, 21 Jul 2011 03:34:56 +0000 Subject: [PATCH] fix loosed formatting to endnotes and footnotes in Word-to-HTML and Word-to-FO converters git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1149022 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/hwpf/converter/WordToFoConverter.java | 24 ++++++++++++++++--- .../hwpf/converter/WordToHtmlConverter.java | 16 ++++++++++++- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoConverter.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoConverter.java index 0c4d31e005..c9873d7c7d 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoConverter.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoConverter.java @@ -284,7 +284,17 @@ public class WordToFoConverter extends AbstractWordConverter backwardLink.appendChild( createNoteInline( textIndex + " " ) ); backwardLink.setAttribute( "id", forwardLinkName ); endnote.appendChild( backwardLink ); - processCharacters( doc, Integer.MIN_VALUE, endnoteTextRange, endnote ); + + blocksProperies.push( new BlockProperies( "", -1, false, false ) ); + try + { + processCharacters( doc, Integer.MIN_VALUE, endnoteTextRange, + endnote ); + } + finally + { + blocksProperies.pop(); + } this.endnotes.add( endnote ); } @@ -317,8 +327,16 @@ public class WordToFoConverter extends AbstractWordConverter footnoteBody.appendChild( footnoteBlock ); footNote.appendChild( footnoteBody ); - processCharacters( doc, Integer.MIN_VALUE, footnoteTextRange, - footnoteBlock ); + blocksProperies.push( new BlockProperies( "", -1, false, false ) ); + try + { + processCharacters( doc, Integer.MIN_VALUE, footnoteTextRange, + footnoteBlock ); + } + finally + { + blocksProperies.pop(); + } } protected void processHyperlink( HWPFDocumentCore wordDocument, diff --git a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java index a112934705..bd88280853 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java @@ -437,7 +437,15 @@ public class WordToHtmlConverter extends AbstractWordConverter span.setAttribute( "class", type + "notetext" ); note.appendChild( span ); - processCharacters( doc, Integer.MIN_VALUE, noteTextRange, span ); + this.blocksProperies.add( new BlockProperies( "", -1 ) ); + try + { + processCharacters( doc, Integer.MIN_VALUE, noteTextRange, span ); + } + finally + { + this.blocksProperies.pop(); + } } protected void processPageref( HWPFDocumentCore hwpfDocument, @@ -658,6 +666,12 @@ public class WordToHtmlConverter extends AbstractWordConverter } final Element tableElement = htmlDocumentFacade.createTable(); + tableElement + .setAttribute( + "class", + htmlDocumentFacade.getOrCreateCssClass( + tableElement.getTagName(), "t", + "table-layout:fixed;border-collapse:collapse;border-spacing:0;" ) ); if ( tableHeader.hasChildNodes() ) { tableElement.appendChild( tableHeader ); -- 2.39.5