Skip to content

Commit

Permalink
Fix the docx issue with grid in grid to setup the old wpml behavior (…
Browse files Browse the repository at this point in the history
…add empty paragraphs) as default (#2010) (#2011)

* Fix the docx issue with grid in grid to setup the old wpml behavior as
default (#2010)

* Increased report version number and added version comment
  • Loading branch information
speckyspooky authored Dec 16, 2024
1 parent 6fa78f7 commit 3a9e7ed
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public enum TextFlag {

protected boolean wrappedTableHeaderFooter = false;

protected boolean addEmptyParagraphToForAllCells = false;
protected boolean addEmptyParagraphToTableCell = false;

protected boolean addEmptyParagraphToListCell = false;

Expand Down Expand Up @@ -349,12 +349,12 @@ public void start(IReportContent report) {
wordWriter.setWrappedTableHeaderFooter(wrappedTableHeaderFooter);
}
// foreign text: add empty paragraph to wrapper table cell
if (wrappedTableForMarginPadding || EmitterServices.booleanOption(null, report, DocEmitter.WORD_ADD_EMPTY_PARAGRAPH_FOR_ALL_CELLS, false)) {
addEmptyParagraphToForAllCells = true;
if (wrappedTableForMarginPadding || EmitterServices.booleanOption(null, report, DocEmitter.WORD_ADD_EMPTY_PARAGRAPH_FOR_TABLE_CELL, true)) {
addEmptyParagraphToTableCell = true;
}

// list: add empty paragraph to list table cell
if (EmitterServices.booleanOption(null, report, DocEmitter.WORD_ADD_EMPTY_PARAGRAPH_FOR_LIST_CELL, false)) {
if (EmitterServices.booleanOption(null, report, DocEmitter.WORD_ADD_EMPTY_PARAGRAPH_FOR_LIST_CELL, true)) {
addEmptyParagraphToListCell = true;
}
}
Expand Down Expand Up @@ -933,7 +933,7 @@ private void writeTableToc() {
public void endCell(ICellContent cell) {
adjustInline();
context.removeWidth();
if (addEmptyParagraphToForAllCells) {
if (addEmptyParagraphToTableCell) {
wordWriter.endTableCell(context.needEmptyP());
} else {
boolean needEmptyPara = !cell.hasChildren();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public class DocEmitter extends ContentEmitterAdapter {
*
* @since 4.18
*/
public static final String WORD_ADD_EMPTY_PARAGRAPH_FOR_ALL_CELLS = "WordEmitter.AddEmptyParagraphForAllCells";
public static final String WORD_ADD_EMPTY_PARAGRAPH_FOR_TABLE_CELL = "WordEmitter.AddEmptyParagraphForTableCell";

/**
* property: Word emitter, add empty paragraph for the list table cell
Expand All @@ -92,7 +92,6 @@ public class DocEmitter extends ContentEmitterAdapter {
*/
public static final String WORD_ADD_EMPTY_PARAGRAPH_FOR_LIST_CELL = "WordEmitter.AddEmptyParagraphForListCell";


private static Logger logger = Logger.getLogger(DocEmitter.class.getName());

protected AbstractEmitterImpl emitterImplement = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,9 @@ private static Object getReportDesignConfiguration(IReportContent reportContent,
} else if (name.equalsIgnoreCase(DocEmitter.WORD_ADD_EMPTY_PARAGRAPH_FOR_LIST_CELL)) {
value = reportContent.getDesign().getReportDesign().getWordListCellAddEmptyPara();

} else if (name.equalsIgnoreCase(DocEmitter.WORD_ADD_EMPTY_PARAGRAPH_FOR_TABLE_CELL)) {
value = reportContent.getDesign().getReportDesign().getWordTableCellAddEmptyPara();

}
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,17 @@ The following list get an overview of all supported user properties, the content
Since 4.18
Designer 4.18

**WordEmitter.AddEmptyParagraphForAllCells**
**WordEmitter.AddEmptyParagraphTableCell**

Content use empty paragraph for the grid & table cell at the end independent of the cell content (standard up to BIRT 4.17)
Content use empty paragraph for the grid & table cell at the end independent of the cell content
Location report
Data type boolean
Values true, add empty paragraph at grid & table cell end
false, avoid empty paragraph at grid & table cell end
Default false, if wrappedTableForMarginPadding is set to false
true, if wrappedTableForMarginPadding is set to true
Default true
Relation WordEmitter.WrappedTableForMarginPadding
Since 4.18
Designer 4.18
Designer 4.19

**WordEmitter.AddEmptyParagraphForListCell**

Expand All @@ -44,7 +43,7 @@ The following list get an overview of all supported user properties, the content
Data type boolean
Values true, add empty paragraph at list table cell end
false, avoid empty paragraph at list table cell end
Default false
Default true
Since 4.18
Designer 4.18

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1912,6 +1912,28 @@ public void setWordListCellAddEmptyPara(boolean addEmptyPara) throws SemanticExc
setBooleanProperty(WORD_LIST_CELL_ADD_EMPTY_PARA, addEmptyPara);
}

/**
* Get the configuration if an empty paragraph is to use at the end of a table
* cell
*
* @return the configuration if an empty paragraph is to use at the end of a
* table cell
*/
public boolean getWordTableCellAddEmptyPara() {
return getBooleanProperty(WORD_TABLE_CELL_ADD_EMPTY_PARA);
}

/**
* Set the configuration if an empty paragraph is to use at the end of a table
* cell
*
* @param addEmptyPara add empty paragraph
* @throws SemanticException
*/
public void setWordTableCellAddEmptyPara(boolean addEmptyPara) throws SemanticException {
setBooleanProperty(WORD_TABLE_CELL_ADD_EMPTY_PARA, addEmptyPara);
}

/**
* Get the configuration to use a wrapping table for margin and padding
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,18 +339,30 @@ public interface IInternalReportDesignModel {

/**
* Word option, use margin & padding for spacing (only without layout-grid)
*
* @since 4.18
*/
String WORD_COMBINE_MARGIN_PADDING = "wordCombineMarginPadding"; //$NON-NLS-1$
/**
* Word option, list element, add empty line of cell end
*
* @since 4.18
*/
String WORD_LIST_CELL_ADD_EMPTY_PARA = "wordAddEmptyParagraphForListCell"; //$NON-NLS-1$
/**
* Word option, list element, add empty line of cell end
*
* @since 4.19
*/
String WORD_TABLE_CELL_ADD_EMPTY_PARA = "wordAddEmptyParagraphForTableCell"; //$NON-NLS-1$
/**
* Word option, text element, use layout-grid for margin & padding
*/
String WORD_WRAP_TABLE_FOR_MARGIN_PADDING = "wordWrappedTableForMarginPadding"; //$NON-NLS-1$
/**
* Word option, page header & footer, use layout-grid
*
* @since 4.18
*/
String WORD_WRAP_TABLE_FOR_HEADER_FOOTER = "wordWrappedTableHeaderFooter"; //$NON-NLS-1$
}
Original file line number Diff line number Diff line change
Expand Up @@ -2000,7 +2000,11 @@
</Property>
<!-- docx (wpml): add empty paragraph at the end of list table cell -->
<Property canInherit="false" displayNameID="Element.ReportDesign.Emitter.word.addEmptyParagraphForListCell" name="wordAddEmptyParagraphForListCell" runtimeSettable="true" since="4.18" type="boolean" >
<Default>false</Default>
<Default>true</Default>
</Property>
<!-- docx (wpml): add empty paragraph at the end of table cell -->
<Property canInherit="false" displayNameID="Element.ReportDesign.Emitter.word.addEmptyParagraphForTableCell" name="wordAddEmptyParagraphForTableCell" runtimeSettable="true" since="4.19" type="boolean" >
<Default>true</Default>
</Property>
<!-- docx (wpml): control the usage of layout-grid for (dynamic) text elements -->
<Property canInherit="false" displayNameID="Element.ReportDesign.Emitter.word.wrappedTableForMarginPadding" name="wordWrappedTableForMarginPadding" runtimeSettable="true" since="4.18" type="boolean" >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2679,7 +2679,8 @@ Element.ReportDesign.Emitter.pdfa.font.cid.embed=PDF/A, include the CIDSet font
Element.ReportDesign.Emitter.pdfa.document.title.embed=PDF/A, embed title
Element.ReportDesign.Emitter.word=Emitter Word configuration
Element.ReportDesign.Emitter.word.combineMarginPadding=Use margin & padding for spacing (only without layout-grid)
Element.ReportDesign.Emitter.word.addEmptyParagraphForListCell=List element, add empty line of cell end
Element.ReportDesign.Emitter.word.addEmptyParagraphForListCell=List element, add empty line at cell end
Element.ReportDesign.Emitter.word.addEmptyParagraphForTableCell=Table element, add empty line at cell end
Element.ReportDesign.Emitter.word.wrappedTableForMarginPadding=Text element, use layout-grid for margin & padding
Element.ReportDesign.Emitter.word.wrappedTableHeaderFooter=Page header & footer, use layout-grid

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ interface IDesignSchemaConstants {
/**
* The version of report design.
*/
String REPORT_VERSION = "3.2.26"; //$NON-NLS-1$
String REPORT_VERSION = "3.2.27"; //$NON-NLS-1$

/**
* The number representation for the current version string.
*/
int REPORT_VERSION_NUMBER = VersionUtil.VERSION_3_2_26;
int REPORT_VERSION_NUMBER = VersionUtil.VERSION_3_2_27;

String ACCESS_CONTROL_TAG = "access-control"; //$NON-NLS-1$
String AUTO_TEXT_TAG = "auto-text"; //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ public class VersionUtil {
/** property: report design file version 3.2.26 */
public static final int VERSION_3_2_26 = 3022600;

/** property: report design file version 3.2.27 */
public static final int VERSION_3_2_27 = 3022700;

/**
*
* @param version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ protected void writeSimpleProperties(ReportDesign obj) {

property(obj, IInternalReportDesignModel.WORD_COMBINE_MARGIN_PADDING);
property(obj, IInternalReportDesignModel.WORD_LIST_CELL_ADD_EMPTY_PARA);
property(obj, IInternalReportDesignModel.WORD_TABLE_CELL_ADD_EMPTY_PARA);
property(obj, IInternalReportDesignModel.WORD_WRAP_TABLE_FOR_MARGIN_PADDING);
property(obj, IInternalReportDesignModel.WORD_WRAP_TABLE_FOR_HEADER_FOOTER);

Expand Down

0 comments on commit 3a9e7ed

Please sign in to comment.