Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excel streaming xlsx option with new configuration UserProperty "ExcelEmitter.StreamingXlsx" #1322 #1323

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* Copyright (c) 2011, 2012, 2013 James Talbut.
* jim-emitters@spudsoft.co.uk
*
*
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* https://www.eclipse.org/legal/epl-2.0/.
*
*
* SPDX-License-Identifier: EPL-2.0
*
*
* Contributors:
* James Talbut - Initial implementation.
************************************************************************************/
Expand Down Expand Up @@ -52,40 +52,101 @@
import uk.co.spudsoft.birt.emitters.excel.framework.Logger;
import uk.co.spudsoft.birt.emitters.excel.handlers.PageHandler;

/**
* Create the excel emitter for output
*
* @since 3.3
*
*/
public abstract class ExcelEmitter implements IContentEmitter {

/** property: ExcelEmitter.DEBUG */
public static final String DEBUG = "ExcelEmitter.DEBUG";

/** property: ExcelEmitter.RemoveBlankRows */
public static final String REMOVE_BLANK_ROWS = "ExcelEmitter.RemoveBlankRows";

/** property: ExcelEmitter.Rotation */
public static final String ROTATION_PROP = "ExcelEmitter.Rotation";

/** property: ExcelEmitter.ForceAutoColWidths */
public static final String FORCEAUTOCOLWIDTHS_PROP = "ExcelEmitter.ForceAutoColWidths";

/** property: ExcelEmitter.SingleSheet */
public static final String SINGLE_SHEET = "ExcelEmitter.SingleSheet";

/** property: ExcelEmitter.SingleSheetWithPageBreaks */
public static final String SINGLE_SHEET_PAGE_BREAKS = "ExcelEmitter.SingleSheetWithPageBreaks";

/** property: ExcelEmitter.InsertPrintBreakAfter */
public static final String PRINT_BREAK_AFTER = "ExcelEmitter.InsertPrintBreakAfter";

/** property: ExcelEmitter.DisableGrouping */
public static final String DISABLE_GROUPING = "ExcelEmitter.DisableGrouping";

/** property: ExcelEmitter.StructuredHeader */
public static final String STRUCTURED_HEADER = "ExcelEmitter.StructuredHeader";

/** property: ExcelEmitter.CustomNumberFormat */
public static final String CUSTOM_NUMBER_FORMAT = "ExcelEmitter.CustomNumberFormat";

/** property: ExcelEmitter.AutoFilter */
public static final String AUTO_FILTER = "ExcelEmitter.AutoFilter";

/** property: ExcelEmitter.SheetProtectPassword */
public static final String SHEET_PASSWORD = "ExcelEmitter.SheetProtectPassword";

/** property: ExcelEmitter.GroupSummaryHeader */
public static final String GROUP_SUMMARY_HEADER = "ExcelEmitter.GroupSummaryHeader";

/** property: ExcelEmitter.FreezePanes */
public static final String FREEZE_PANES = "ExcelEmitter.FreezePanes";

/** property: ExcelEmitter.BlankRowAfterTopLevelTable */
public static final String BLANK_ROW_AFTER_TOP_LEVEL_TABLE = "ExcelEmitter.BlankRowAfterTopLevelTable";

/** property: ExcelEmitter.SpannedRowHeight */
public static final String SPANNED_ROW_HEIGHT = "ExcelEmitter.SpannedRowHeight";

/** property: ExcelEmitter.NestedTableInLastCell */
public static final String NEST_TABLE_IN_LAST_CELL = "ExcelEmitter.NestedTableInLastCell";

/** property: spanned row height spread */
public static final int SPANNED_ROW_HEIGHT_SPREAD = 0;

/** property: spanned row height first */
public static final int SPANNED_ROW_HEIGHT_FIRST = 1;

/** property: spanned row height ignored */
public static final int SPANNED_ROW_HEIGHT_IGNORED = 2;

/** property: ExcelEmitter.PrintScale */
public static final String PRINT_SCALE = "ExcelEmitter.PrintScale";

/** property: ExcelEmitter.PrintPagesWide */
public static final String PRINT_PAGES_WIDE = "ExcelEmitter.PrintPagesWide";

/** property: ExcelEmitter.PrintPagesHigh */
public static final String PRINT_PAGES_HIGH = "ExcelEmitter.PrintPagesHigh";

/** property: ExcelEmitter.DisplayFormulas */
public static final String DISPLAYFORMULAS_PROP = "ExcelEmitter.DisplayFormulas";

/** property: ExcelEmitter.DisplayGridlines */
public static final String DISPLAYGRIDLINES_PROP = "ExcelEmitter.DisplayGridlines";

/** property: ExcelEmitter.DisplayRowColHeadings */
public static final String DISPLAYROWCOLHEADINGS_PROP = "ExcelEmitter.DisplayRowColHeadings";

/** property: ExcelEmitter.DisplayZeros */
public static final String DISPLAYZEROS_PROP = "ExcelEmitter.DisplayZeros";

/** property: ExcelEmitter.TemplateFile */
public static final String TEMPLATE_FILE = "ExcelEmitter.TemplateFile";

/** property: ExcelEmitter.StreamingXlsx */
public static final String STREAMING_XLSX = "ExcelEmitter.StreamingXlsx";

/**
* Logger.
*/
Expand Down Expand Up @@ -160,6 +221,15 @@ protected ExcelEmitter(StyleManagerUtils.Factory utilsFactory) {
*/
protected abstract Workbook createWorkbook();

/**
* Constructs a new workbook to be processed by the emitter.
*
* @return The new (streaming) workbook.
*
* @since 4.14
*/
protected abstract Workbook createSWorkbook();

/**
* Constructs a new workbook to be processed by the emitter.
*
Expand Down Expand Up @@ -206,7 +276,11 @@ public void start(IReportContent report) throws BirtException {
"Unable to open template workbook for " + templateFile.toString(), ex);
}
} else {
wb = createWorkbook();
if (EmitterServices.booleanOption(renderOptions, report, ExcelEmitter.STREAMING_XLSX, false)) {
wb = createSWorkbook();
} else {
wb = createWorkbook();
}
}

CSSEngine cssEngine = report.getRoot().getCSSEngine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* Copyright (c) 2011, 2012, 2013 James Talbut.
* jim-emitters@spudsoft.co.uk
*
*
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* https://www.eclipse.org/legal/epl-2.0/.
*
*
* SPDX-License-Identifier: EPL-2.0
*
*
* Contributors:
* James Talbut - Initial implementation.
************************************************************************************/
Expand Down Expand Up @@ -49,6 +49,11 @@ protected Workbook createWorkbook() {
return new HSSFWorkbook();
}

@Override
protected Workbook createSWorkbook() {
return new HSSFWorkbook();
}

@Override
protected Workbook openWorkbook(File templateFile) throws IOException {
InputStream stream = new FileInputStream(templateFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* Copyright (c) 2011, 2012, 2013 James Talbut.
* jim-emitters@spudsoft.co.uk
*
*
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* https://www.eclipse.org/legal/epl-2.0/.
*
*
* SPDX-License-Identifier: EPL-2.0
*
*
* Contributors:
* James Talbut - Initial implementation.
************************************************************************************/
Expand All @@ -21,6 +21,7 @@
import java.io.InputStream;

import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

/**
Expand Down Expand Up @@ -49,6 +50,21 @@ protected Workbook createWorkbook() {
return new XSSFWorkbook();
}

/**
* Create a workbook of xlsx with streaming support
*
* @return xlsx workbook for streaming
*
* @since 4.14
*/
public Workbook createSWorkbook() {
SXSSFWorkbook swb = new SXSSFWorkbook();
// temp files will be gzipped
swb.setCompressTempFiles(true);

return swb;
}

@Override
protected Workbook openWorkbook(File templateFile) throws IOException {
InputStream stream = new FileInputStream(templateFile);
Expand Down
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -47,43 +47,43 @@
<TR>
<TD WIDTH="6px"/>
<TD WIDTH="15px">
<INPUT TYPE="image" NAME='toc' SRC="birt/images/Toc.gif"
TITLE="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.toc" )%>"
ALT="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.toc" )%>" CLASS="birtviewer_clickable">
<INPUT TYPE="image" NAME='toc' SRC="birt/images/ReportToc.png"
TITLE="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.toc" )%>"
ALT="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.toc" )%>" CLASS="birtviewer_clickable icon_main_functions">
</TD>
<TD WIDTH="6px"/>
<TD WIDTH="15px">
<INPUT TYPE="image" NAME='parameter' SRC="birt/images/Report_parameters.gif"
TITLE="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.parameter" )%>"
ALT="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.parameter" )%>" CLASS="birtviewer_clickable">
<INPUT TYPE="image" NAME='parameter' SRC="birt/images/ReportParameters.png"
TITLE="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.parameter" )%>"
ALT="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.parameter" )%>" CLASS="birtviewer_clickable icon_main_functions">
</TD>
<TD WIDTH="6px"/>
<TD WIDTH="15px">
<INPUT TYPE="image" NAME='export' SRC="birt/images/Export.gif"
TITLE="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.export" )%>"
ALT="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.export" )%>" CLASS="birtviewer_clickable">
<INPUT TYPE="image" NAME='export' SRC="birt/images/ReportCsv.png"
TITLE="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.export" )%>"
ALT="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.export" )%>" CLASS="birtviewer_clickable icon_main_functions">
</TD>
<TD WIDTH="6px"/>
<TD WIDTH="15px">
<INPUT TYPE="image" NAME='exportReport' SRC="birt/images/ExportReport.gif"
TITLE="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.exportreport" )%>"
ALT="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.exportreport" )%>" CLASS="birtviewer_clickable">
<INPUT TYPE="image" NAME='exportReport' SRC="birt/images/ReportExport.png"
TITLE="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.exportreport" )%>"
ALT="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.exportreport" )%>" CLASS="birtviewer_clickable icon_main_functions">
</TD>
<TD WIDTH="6px"/>
<TD WIDTH="15px">
<INPUT TYPE="image" NAME='print' SRC="birt/images/Print.gif"
TITLE="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.print" )%>"
ALT="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.print" )%>" CLASS="birtviewer_clickable">
<INPUT TYPE="image" NAME='print' SRC="birt/images/Print.png"
TITLE="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.print" )%>"
ALT="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.print" )%>" CLASS="birtviewer_clickable icon_main_functions">
</TD>
<%
if( ParameterAccessor.isSupportedPrintOnServer )
{
%>
<TD WIDTH="6px"/>
<TD WIDTH="15px">
<INPUT TYPE="image" NAME='printServer' SRC="birt/images/PrintServer.gif"
TITLE="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.printserver" )%>"
ALT="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.printserver" )%>" CLASS="birtviewer_clickable">
<INPUT TYPE="image" NAME='printServer' SRC="birt/images/PrintServer.png"
TITLE="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.printserver" )%>"
ALT="<%= BirtResources.getHtmlMessage( "birt.viewer.toolbar.printserver" )%>" CLASS="birtviewer_clickable icon_main_functions">
</TD>
<%
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<TABLE CELLSPACING="2" CELLPADDING="2" ID="parameter_table" CLASS="birtviewer_dialog_body">
<TR VALIGN="top">
<TD>
<TABLE STYLE="font-size:8pt">
<TABLE>
<TR HEIGHT="5px"><TD></TD></TR>
<%
if ( fragments.size( ) <= 0 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
%>
<TR>
<TD NOWRAP>
<IMG SRC="birt/images/parameter.gif" ALT="<%= parameterBean.getDisplayName( ) %>" TITLE="<%= parameterBean.getToolTip( ) %>"/>
<IMG class="icon_parameter" SRC="birt/images/Parameter.png" ALT="<%= parameterBean.getDisplayName( ) %>" TITLE="<%= parameterBean.getToolTip( ) %>"/>
</TD>
<TD NOWRAP>
<FONT TITLE="<%= parameterBean.getToolTip( ) %>"><LABEL FOR="<%= encodedParameterName %>"><%= parameterBean.getDisplayName( ) %>:</LABEL></FONT>
<SPAN TITLE="<%= parameterBean.getToolTip( ) %>"><LABEL FOR="<%= encodedParameterName %>"><%= parameterBean.getDisplayName( ) %>:</LABEL></SPAN>
<%-- is required --%>
<%
if ( parameterBean.isRequired( ) )
{
%>
<FONT COLOR="red"><LABEL FOR="<%= encodedParameterName %>">*</LABEL></FONT>
<SPAN style="color:red;"><LABEL FOR="<%= encodedParameterName %>">*</LABEL></SPAN>
<%
}
%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@
%>
<TR>
<TD NOWRAP>
<IMG SRC="birt/images/parameter.gif" ALT="<%= parameterBean.getDisplayName( ) %>" TITLE="<%= parameterBean.getToolTip( ) %>"/>
<IMG class="icon_parameter" SRC="birt/images/Parameter.png" ALT="<%= parameterBean.getDisplayName( ) %>" TITLE="<%= parameterBean.getToolTip( ) %>"/>
</TD>
<TD NOWRAP>
<FONT TITLE="<%= parameterBean.getToolTip( ) %>"><LABEL FOR="<%= encodedParameterName + "_selection"%>"><%= parameterBean.getDisplayName( ) %>:</LABEL></FONT>
<SPAN TITLE="<%= parameterBean.getToolTip( ) %>"><LABEL FOR="<%= encodedParameterName + "_selection"%>"><%= parameterBean.getDisplayName( ) %>:</LABEL></SPAN>
<%-- is required --%>
<%
if ( parameterBean.isRequired( ) )
{
%>
<FONT COLOR="red"><LABEL FOR="<%= encodedParameterName + "_selection"%>">*</LABEL></FONT>
<SPAN style="color:red;"><LABEL FOR="<%= encodedParameterName + "_selection"%>">*</LABEL></SPAN>
<%
}
%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@
<%
ParameterGroupBean parameterGroupBean = ( ParameterGroupBean ) attributeBean.getParameterBean( );
%>
<TR><TD HEIGHT="16px" COLSPAN="2"></TD></TR>
<TR><TD HEIGHT="24px" COLSPAN="2"></TD></TR>
<%
if ( parameterGroupBean.getDisplayName( ) != null )
{
%>
<TR>
<TD NOWRAP>
<IMG SRC="birt/images/parameter_group.gif" ALT="<%= parameterGroupBean.getDisplayName( ) %>" TITLE="<%= parameterGroupBean.getToolTip( ) %>"/>
<IMG class="icon_parameter_group" SRC="birt/images/ParameterGroup.png" ALT="<%= parameterGroupBean.getDisplayName( ) %>" TITLE="<%= parameterGroupBean.getToolTip( ) %>"/>
</TD>
<TD NOWRAP>
<FONT TITLE="<%= parameterGroupBean.getToolTip( ) %>"><B><%= parameterGroupBean.getDisplayName( ) %></B></FONT>
<SPAN style="font-weight:bold;" TITLE="<%= parameterGroupBean.getToolTip( ) %>"><%= parameterGroupBean.getDisplayName( ) %></SPAN>
</TD>
</TR>
<%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
%>
<TR>
<TD NOWRAP>
<IMG SRC="birt/images/parameter.gif" ALT="<%= parameterBean.getDisplayName( ) %>" TITLE="<%= parameterBean.getToolTip( ) %>"/>
<IMG class="icon_parameter" SRC="birt/images/Parameter.png" ALT="<%= parameterBean.getDisplayName( ) %>" TITLE="<%= parameterBean.getToolTip( ) %>"/>
</TD>
<TD NOWRAP>
<LABEL TITLE="<%= parameterBean.getToolTip( ) %>" ID="id_<%= parameterBean.getName()%>" FOR="<%=encodedParameterName%>" + "0"><%= parameterBean.getDisplayName( ) %>:</LABEL>
Expand All @@ -41,7 +41,7 @@
if ( parameterBean.isRequired( ) )
{
%>
<FONT COLOR="red">*</FONT>
<SPAN style="color:red;">*</SPAN>
<%
}
%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
%>
<TR>
<TD NOWRAP>
<IMG SRC="birt/images/parameter.gif" ALT="<%= parameterBean.getDisplayName( ) %>" TITLE="<%= parameterBean.getToolTip( ) %>"/>
<IMG class="icon_parameter" SRC="birt/images/Parameter.png" ALT="<%= parameterBean.getDisplayName( ) %>" TITLE="<%= parameterBean.getToolTip( ) %>"/>
</TD>
<TD NOWRAP>
<FONT TITLE="<%= parameterBean.getToolTip( ) %>"><LABEL FOR="<%= encodedParameterName %>"><%= parameterBean.getDisplayName( ) %>:</LABEL></FONT>
<SPAN TITLE="<%= parameterBean.getToolTip( ) %>"><LABEL FOR="<%= encodedParameterName %>"><%= parameterBean.getDisplayName( ) %>:</LABEL></SPAN>
<%-- is required --%>
<%
if ( parameterBean.isRequired( ) )
{
%>
<FONT COLOR="red"><LABEL FOR="<%= encodedParameterName %>">*</LABEL></FONT>
<SPAN style="color:red;"><LABEL FOR="<%= encodedParameterName %>">*</LABEL></SPAN>
<%
}
%>
Expand Down
Loading
Loading