Skip to content

Commit

Permalink
Enhance the property for the excel emitter (#1787) (#1788)
Browse files Browse the repository at this point in the history
  • Loading branch information
speckyspooky authored Jul 13, 2024
1 parent 4e9698d commit af6352c
Show file tree
Hide file tree
Showing 6 changed files with 211 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,36 @@ public static boolean booleanOption(ITaskOption options, IReportContent reportCo
*/
private static Object getReportDesignConfiguration(IReportContent reportContent, String name) {
Object value = null;
if (name.equalsIgnoreCase(ExcelEmitter.SINGLE_SHEET)) {
value = reportContent.getDesign().getReportDesign().getExcelSingleSheet();

if (name.equalsIgnoreCase(ExcelEmitter.AUTO_FILTER)) {
value = reportContent.getDesign().getReportDesign().getExcelAutoFilter();

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

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

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

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

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

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

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

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

} else if (name.equalsIgnoreCase(ExcelEmitter.STRUCTURED_HEADER)) {
value = reportContent.getDesign().getReportDesign().getExcelStructuredHeader();
}
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1504,4 +1504,119 @@ public boolean getExcelDisplayGridlines() {
public void setExcelDisplayGridlines(boolean displayGridlines) throws SemanticException {
setBooleanProperty(EXCEL_DISPLAY_GRIDLINES, displayGridlines);
}

/**
* Get the display of the excel auto filter
*
* @return the configuration to display the auto filter
*/
public boolean getExcelAutoFilter() {
return getBooleanProperty(EXCEL_AUTO_FILTER);
}

/**
* Set the display of the excel auto filter
*
* @param enableAutoFilter enable auto filter
* @throws SemanticException
*/
public void setExcelAutoFilter(boolean enableAutoFilter) throws SemanticException {
setBooleanProperty(EXCEL_AUTO_FILTER, enableAutoFilter);
}

/**
* Get the configuration for the forced recalculation
*
* @return the configuration to display grind lines
*/
public boolean getExcelForceRecalculation() {
return getBooleanProperty(EXCEL_FORCE_RECALCULATION);
}

/**
* Set the forced recalculation of excel
*
* @param forceRecalculation enable the forced recalculation
* @throws SemanticException
*/
public void setExcelForceRecalculation(boolean forceRecalculation) throws SemanticException {
setBooleanProperty(EXCEL_FORCE_RECALCULATION, forceRecalculation);
}

/**
* Get the configuration for the excel image scaling to cell dimension
*
* @return the configuration to use the image scaling
*/
public boolean getExcelImageScaling() {
return getBooleanProperty(EXCEL_IMAGE_SCALING_CELL_DIMENSION);
}

/**
* Set the display of grid line for the excel output
*
* @param enableImageScaling enable image scaling
* @throws SemanticException
*/
public void setExcelImageScaling(boolean enableImageScaling) throws SemanticException {
setBooleanProperty(EXCEL_IMAGE_SCALING_CELL_DIMENSION, enableImageScaling);
}

/**
* Get the configuration for additional page break of single sheet
*
* @return the configuration for additional page break of single sheet
*/
public boolean getExcelSingleSheetPageBreak() {
return getBooleanProperty(EXCEL_SINGLE_SHEET_WITH_PAGE_BREAK);
}

/**
* Set an additional page break to single sheet
*
* @param singleSheetPageBreak add the single sheet page break
* @throws SemanticException
*/
public void setExcelSingleSheetPageBreak(boolean singleSheetPageBreak) throws SemanticException {
setBooleanProperty(EXCEL_SINGLE_SHEET_WITH_PAGE_BREAK, singleSheetPageBreak);
}

/**
* Get the configuration if data streaming of XLSX is enabled
*
* @return the configuration if data streaming of XLSX is enabled
*/
public boolean getExcelStreamingXlsx() {
return getBooleanProperty(EXCEL_STREAMING_XLSX);
}

/**
* Set the output method to data streaming
*
* @param streamingXlsx enable the XLSX streaming
* @throws SemanticException
*/
public void setExcelStreamingXlsx(boolean streamingXlsx) throws SemanticException {
setBooleanProperty(EXCEL_STREAMING_XLSX, streamingXlsx);
}

/**
* Get the configuration to display the report header and footer
*
* @return the configuration to display the report header and footer
*/
public boolean getExcelStructuredHeader() {
return getBooleanProperty(EXCEL_STRUCTURED_HEADER);
}

/**
* Set the display of report header and footer on excel sheet
*
* @param structuredHeader display report header and footer at excel sheet
* @throws SemanticException
*/
public void setExcelStructuredHeader(boolean structuredHeader) throws SemanticException {
setBooleanProperty(EXCEL_STRUCTURED_HEADER, structuredHeader);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,34 @@ public interface IInternalReportDesignModel {
* Excel option, display grid lines
*/
String EXCEL_DISPLAY_GRIDLINES = "excelDisplayGridlines"; //$NON-NLS-1$

/**
* Excel option, add auto filter to header row
*/
String EXCEL_AUTO_FILTER = "excelAutoFilter"; //$NON-NLS-1$

/**
* Excel option, force recalculation
*/
String EXCEL_FORCE_RECALCULATION = "excelForceRecalculation"; //$NON-NLS-1$

/**
* Excel option, scale the images to cell dimension
*/
String EXCEL_IMAGE_SCALING_CELL_DIMENSION = "excelImageScalingToCellDimension"; //$NON-NLS-1$

/**
* Excel option, create page break on single sheet
*/
String EXCEL_SINGLE_SHEET_WITH_PAGE_BREAK = "excelSingleSheetWithPageBreaks"; //$NON-NLS-1$

/**
* Excel option, write data with streaming mode
*/
String EXCEL_STREAMING_XLSX = "excelStreamingXlsx"; //$NON-NLS-1$

/**
* Excel option, display report header and footer at excel sheet
*/
String EXCEL_STRUCTURED_HEADER = "excelStructuredHeader"; //$NON-NLS-1$
}
Original file line number Diff line number Diff line change
Expand Up @@ -1888,21 +1888,45 @@
<Property displayNameID="Element.ReportDesign.locale" name="locale" since="2.5" type="locale" />
<Property displayNameID="Element.ReportDesign.language" name="language" since="4.3" type="string" />
<PropertyGroup displayNameID="Element.ReportDesign.Emitter.excel">
<!-- excel (spudsoft): force the column width calculation -->
<!-- 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): output of table as single sheet -->
<!-- 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" >
<Default>false</Default>
</Property>
<!-- excel (spudsoft): disable the excel grouping -->
<!-- excel (Spudsoft): disable the excel grouping -->
<Property canInherit="false" displayNameID="Element.ReportDesign.Emitter.excel.disableGrouping" name="excelDisableGrouping" runtimeSettable="false" since="4.17" type="boolean" >
<Default>false</Default>
</Property>
<!-- excel (spudsoft): show/hide the excel gridlines -->
<!-- excel (Spudsoft): show/hide the excel gridlines -->
<Property canInherit="false" displayNameID="Element.ReportDesign.Emitter.excel.displayGridlines" name="excelDisplayGridlines" runtimeSettable="false" since="4.17" type="boolean" >
<Default>true</Default>
</Property>
<!-- excel (Spudsoft): show/hide auto filter at header row -->
<Property canInherit="false" displayNameID="Element.ReportDesign.Emitter.excel.autoFilter" name="excelAutoFilter" runtimeSettable="false" since="4.17" type="boolean" >
<Default>false</Default>
</Property>
<!-- excel (Spudsoft): enable/disable the recalculation of formulas at excel start -->
<Property canInherit="false" displayNameID="Element.ReportDesign.Emitter.excel.forceRecalculation" name="excelForceRecalculation" runtimeSettable="false" since="4.17" type="boolean" >
<Default>false</Default>
</Property>
<!-- excel (Spudsoft): enable/disable the image scaling based on cell dimensions -->
<Property canInherit="false" displayNameID="Element.ReportDesign.Emitter.excel.imageScalingToCellDimension" name="excelImageScalingToCellDimension" runtimeSettable="false" since="4.17" type="boolean" >
<Default>false</Default>
</Property>
<!-- excel (Spudsoft): enable/disable single sheet with page break -->
<Property canInherit="false" displayNameID="Element.ReportDesign.Emitter.excel.singleSheetWithPageBreaks" name="excelSingleSheetWithPageBreaks" runtimeSettable="false" since="4.17" type="boolean" >
<Default>false</Default>
</Property>
<!-- excel (Spudsoft): enable/disable the XLSX creation based on data streaming -->
<Property canInherit="false" displayNameID="Element.ReportDesign.Emitter.excel.streamingXlsx" name="excelStreamingXlsx" runtimeSettable="false" since="4.17" type="boolean" >
<Default>false</Default>
</Property>
<!-- excel (Spudsoft): show/hide the header and footer on excel sheet -->
<Property canInherit="false" displayNameID="Element.ReportDesign.Emitter.excel.structuredHeader" name="excelStructuredHeader" runtimeSettable="false" since="4.17" type="boolean" >
<Default>false</Default>
</Property>
</PropertyGroup>
<Method context="client" displayNameID="Element.ReportDesign.clientInitialize" name="clientInitialize" since="1.0" toolTipID="Element.ReportDesign.clientInitialize.toolTip">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2629,9 +2629,15 @@ 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.singleSheet=Excel output as single sheet
Element.ReportDesign.Emitter.excel.singleSheet=Single sheet
Element.ReportDesign.Emitter.excel.disableGrouping=Disable grouping
Element.ReportDesign.Emitter.excel.displayGridlines=Display grid lines
Element.ReportDesign.Emitter.excel.autoFilter=Auto filter for header row
Element.ReportDesign.Emitter.excel.forceRecalculation=Force recalculation
Element.ReportDesign.Emitter.excel.imageScalingToCellDimension=Image scaling to cell dimension
Element.ReportDesign.Emitter.excel.singleSheetWithPageBreaks=Single sheet with page break
Element.ReportDesign.Emitter.excel.streamingXlsx=Stream writing for XLSX
Element.ReportDesign.Emitter.excel.structuredHeader=Display report footer and header

#2. Report Element ( Prefix = Element.ReportElement )
Element.ReportElement.displayName=Display name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.eclipse.birt.report.model.core.Module;
import org.eclipse.birt.report.model.elements.ReportDesign;
import org.eclipse.birt.report.model.elements.interfaces.IDesignElementModel;
import org.eclipse.birt.report.model.elements.interfaces.IInternalReportDesignModel;
import org.eclipse.birt.report.model.elements.interfaces.IReportDesignModel;
import org.eclipse.birt.report.model.parser.DesignSchemaConstants;

Expand Down Expand Up @@ -126,10 +127,16 @@ protected void writeSimpleProperties(ReportDesign obj) {
property(obj, IReportDesignModel.IMAGE_DPI_PROP);
property(obj, IReportDesignModel.LOCALE_PROP);

property(obj, IReportDesignModel.EXCEL_DISABLE_GROUPING);
property(obj, IReportDesignModel.EXCEL_FORCE_AUTO_COL_WIDTHS);
property(obj, IReportDesignModel.EXCEL_SINGLE_SHEET);
property(obj, IReportDesignModel.EXCEL_DISPLAY_GRIDLINES);
property(obj, IInternalReportDesignModel.EXCEL_DISABLE_GROUPING);
property(obj, IInternalReportDesignModel.EXCEL_FORCE_AUTO_COL_WIDTHS);
property(obj, IInternalReportDesignModel.EXCEL_SINGLE_SHEET);
property(obj, IInternalReportDesignModel.EXCEL_DISPLAY_GRIDLINES);
property(obj, IInternalReportDesignModel.EXCEL_AUTO_FILTER);
property(obj, IInternalReportDesignModel.EXCEL_FORCE_RECALCULATION);
property(obj, IInternalReportDesignModel.EXCEL_IMAGE_SCALING_CELL_DIMENSION);
property(obj, IInternalReportDesignModel.EXCEL_SINGLE_SHEET_WITH_PAGE_BREAK);
property(obj, IInternalReportDesignModel.EXCEL_STREAMING_XLSX);
property(obj, IInternalReportDesignModel.EXCEL_STRUCTURED_HEADER);

// include libraries and scripts

Expand Down

0 comments on commit af6352c

Please sign in to comment.