Skip to content

Commit

Permalink
Make the new properties configurable with the UI like the others
Browse files Browse the repository at this point in the history
  • Loading branch information
hvbtup committed Jan 7, 2025
1 parent bb4fe70 commit f1b3063
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@ private static Object getReportDesignConfiguration(IReportContent reportContent,
} else if (name.equalsIgnoreCase(ExcelEmitter.FORCEAUTOCOLWIDTHS_PROP)) {
value = reportContent.getDesign().getReportDesign().getExcelForceAutoColWidths();

} else if (name.equalsIgnoreCase(ExcelEmitter.AUTO_COL_WIDTHS_INCLUDE_TABLE_HEADER)) {
value = reportContent.getDesign().getReportDesign().getExcelAutoColWidthsIncludeTableHeader();

} else if (name.equalsIgnoreCase(ExcelEmitter.AUTO_COL_WIDTHS_INCLUDE_TABLE_FOOTER)) {
value = reportContent.getDesign().getReportDesign().getExcelAutoColWidthsIncludeTableFooter();

} else if (name.equalsIgnoreCase(ExcelEmitter.IMAGE_SCALING_CELL_DIMENSION)) {
value = reportContent.getDesign().getReportDesign().getExcelImageScaling();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ public abstract class ExcelEmitter implements IContentEmitter {
public static final String FORCEAUTOCOLWIDTHS_PROP = "ExcelEmitter.ForceAutoColWidths";

/** property: ExcelEmitter.ForceAutoColWidthsIncludeTableHeader */
public static final String AUTO_COL_WIDTHS_HEADER = "ExcelEmitter.AutoColWidthsIncludeTableHeader";
public static final String AUTO_COL_WIDTHS_INCLUDE_TABLE_HEADER = "ExcelEmitter.AutoColWidthsIncludeTableHeader";

/** property: ExcelEmitter.ForceAutoColWidthsIncludeTableFooter */
public static final String AUTO_COL_WIDTHS_FOOTER = "ExcelEmitter.AutoColWidthsIncludeTableFooter";
public static final String AUTO_COL_WIDTHS_INCLUDE_TABLE_FOOTER = "ExcelEmitter.AutoColWidthsIncludeTableFooter";

/** property: ExcelEmitter.SingleSheet */
public static final String SINGLE_SHEET = "ExcelEmitter.SingleSheet";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ The following list get an overview of all supported user properties, the content
**ExcelEmitter.AutoColWidthsIncludeTableFooter**

Content define if the table footer row (only one footer row is supported) is included in the column width calculation.
This is only used when ExcelEmitter.AutoFilter is true.
Location report
Data type boolean
Values true, the table footer row is included in the column width calculation
false, the table footer row is ignored in the column width calculation
Default false
Since 4.19
Designer 4.19

**ExcelEmitter.AutoColWidthsIncludeTableHeader**

Content define if the table header rows are included in the column width calculation.
This is only used when ExcelEmitter.AutoFilter is true.
Location report
Data type boolean
Values true, the table header rows are included in the column width calculation
false, the table header rows are ignored in the column width calculation
Default false
Since 4.19
Designer 4.19


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,14 @@ public void endTable(HandlerState state, ITableContent table) throws BirtExcepti
log.debug("Details rows from ", startDetailsRow, " to ", endDetailsRow);

int autoWidthStartRow = startDetailsRow;
if (EmitterServices.booleanOption(state.getRenderOptions(), table, ExcelEmitter.AUTO_COL_WIDTHS_HEADER,
if (EmitterServices.booleanOption(state.getRenderOptions(), table,
ExcelEmitter.AUTO_COL_WIDTHS_INCLUDE_TABLE_HEADER,
false)) {
autoWidthStartRow = startRow;
}
int autoWidthEndRow = endDetailsRow;
if (EmitterServices.booleanOption(state.getRenderOptions(), table, ExcelEmitter.AUTO_COL_WIDTHS_FOOTER,
if (EmitterServices.booleanOption(state.getRenderOptions(), table,
ExcelEmitter.AUTO_COL_WIDTHS_INCLUDE_TABLE_FOOTER,
false)) {
autoWidthEndRow = state.rowNum - 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1434,6 +1434,48 @@ public void setExcelForceAutoColWidths(boolean forceAutoColWidths) throws Semant
setBooleanProperty(EXCEL_FORCE_AUTO_COL_WIDTHS, forceAutoColWidths);
}

/**
* Get the auto column width include header flag for the excel output
*
* @return include the header rows in auto columns widths calculation or not
*/
public boolean getExcelAutoColWidthsIncludeTableHeader() {
return getBooleanProperty(EXCEL_AUTO_COL_WIDTHS_INCLUDE_TABLE_HEADER);
}

/**
* Set the auto column width include header flag for the excel output
*
* @param autoColWidthsIncludeTableHeader include header rows in auto columns widths
* calculation
* @throws SemanticException
*/
public void setExcelAutoColWidthsIncludeTableHeader(boolean autoColWidthsIncludeTableHeader)
throws SemanticException {
setBooleanProperty(EXCEL_AUTO_COL_WIDTHS_INCLUDE_TABLE_HEADER, autoColWidthsIncludeTableHeader);
}

/**
* Get the auto column width include footer flag for the excel output
*
* @return include the footer row in auto columns widths calculation or not
*/
public boolean getExcelAutoColWidthsIncludeTableFooter() {
return getBooleanProperty(EXCEL_AUTO_COL_WIDTHS_INCLUDE_TABLE_FOOTER);
}

/**
* Set the auto column width include footer flag for the excel output
*
* @param autoColWidthsIncludeTableFooter include footer row in auto columns
* widths calculation
* @throws SemanticException
*/
public void setExcelAutoColWidthsIncludeTableFooter(boolean autoColWidthsIncludeTableFooter)
throws SemanticException {
setBooleanProperty(EXCEL_AUTO_COL_WIDTHS_INCLUDE_TABLE_FOOTER, autoColWidthsIncludeTableFooter);
}

/**
* Get the configuration for the excel handling of single sheet result
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,16 @@ public interface IInternalReportDesignModel {
*/
String EXCEL_FORCE_AUTO_COL_WIDTHS = "excelForceAutoColWidths"; //$NON-NLS-1$

/**
* Excel option, include header rows in auto column width calculation
*/
String EXCEL_AUTO_COL_WIDTHS_INCLUDE_TABLE_HEADER = "excelAutoColWidthsIncludeTableHeader"; //$NON-NLS-1$

/**
* Excel option, include footer row in auto column width calculation
*/
String EXCEL_AUTO_COL_WIDTHS_INCLUDE_TABLE_FOOTER = "excelAutoColWidthsIncludeTableFooter"; //$NON-NLS-1$

/**
* Excel option, create only singe sheet
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1943,6 +1943,14 @@
<!-- excel (Spudsoft): force the column width calculation -->
<Property canInherit="false" displayNameID="Element.ReportDesign.Emitter.excel.forceAutoColWidths" name="excelForceAutoColWidths" runtimeSettable="false" since="4.17" type="boolean" >
<Default>false</Default>
</Property>
<!-- excel (Spudsoft): include header in the column width calculation -->
<Property canInherit="false" displayNameID="Element.ReportDesign.Emitter.excel.autoColWidthsIncludeHeader" name="excelAutoColWidthsIncludeTableHeader" runtimeSettable="false" since="4.19" type="boolean" >
<Default>false</Default>
</Property>
<!-- excel (Spudsoft): include footer in the column width calculation -->
<Property canInherit="false" displayNameID="Element.ReportDesign.Emitter.excel.autoColWidthsIncludeFooter" name="excelAutoColWidthsIncludeTableFooter" runtimeSettable="false" since="4.19" type="boolean" >
<Default>false</Default>
</Property>
<!-- excel (Spudsoft): output of table as single sheet -->
<Property canInherit="false" displayNameID="Element.ReportDesign.Emitter.excel.singleSheet" name="excelSingleSheet" runtimeSettable="false" since="4.17" type="boolean" >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2653,6 +2653,8 @@ Element.ReportDesign.language=Language
Element.ReportDesign.PDFAccessible=Accessible PDF
Element.ReportDesign.Emitter.excel=Emitter Excel configuration
Element.ReportDesign.Emitter.excel.forceAutoColWidths=Force auto column width calculation
Element.ReportDesign.Emitter.excel.autoColWidthsIncludeHeader=Include header rows in auto column width calculation
Element.ReportDesign.Emitter.excel.autoColWidthsIncludeFooter=Include footer rows in auto column width calculation
Element.ReportDesign.Emitter.excel.singleSheet=Single sheet
Element.ReportDesign.Emitter.excel.disableGrouping=Disable grouping
Element.ReportDesign.Emitter.excel.displayGridlines=Display grid lines
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ protected void writeSimpleProperties(ReportDesign obj) {

property(obj, IInternalReportDesignModel.EXCEL_DISABLE_GROUPING);
property(obj, IInternalReportDesignModel.EXCEL_FORCE_AUTO_COL_WIDTHS);
property(obj, IInternalReportDesignModel.EXCEL_AUTO_COL_WIDTHS_INCLUDE_TABLE_HEADER);
property(obj, IInternalReportDesignModel.EXCEL_AUTO_COL_WIDTHS_INCLUDE_TABLE_FOOTER);
property(obj, IInternalReportDesignModel.EXCEL_SINGLE_SHEET);
property(obj, IInternalReportDesignModel.EXCEL_DISPLAY_GRIDLINES);
property(obj, IInternalReportDesignModel.EXCEL_AUTO_FILTER);
Expand Down

0 comments on commit f1b3063

Please sign in to comment.