myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dennis Byrne" <den...@dbyrne.net>
Subject Re: ExcelExport
Date Tue, 27 Mar 2007 08:40:43 GMT
Marco,

Thanks for playing a part in the community.  Please open an issue in the
issue tracker
http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10600 , along
with your patch.

Dennis Byrne

On 3/27/07, Marco Pöhler <marco.poehler@poehlerpoehler.de> wrote:
>
> Hi,
>
> I have two minor changes made to the Excelexport to make it work with
> facelets (or more exacly to work with other suffixes as .jsf) and to
> avoid hints in new Excel-Versions if you have Numbers in Text-Cells.
>
> This is my first try to contribute, I hope everything is okay. Don't
> hesitate to correct me.
>
> best regards
>
> Marco
>
> Index:
>
> /myfaces-current/tomahawk/sandbox/core/src/main/java/org/apache/myfaces/custom/excelexport/ExcelExportRenderer.java
> ===================================================================
> ---
>
> /myfaces-current/tomahawk/sandbox/core/src/main/java/org/apache/myfaces/custom/excelexport/ExcelExportRenderer.java
> (revision 522807)
> +++
>
> /myfaces-current/tomahawk/sandbox/core/src/main/java/org/apache/myfaces/custom/excelexport/ExcelExportRenderer.java
> (working copy)
> @@ -67,8 +67,10 @@
>
>      private String getJSCall(FacesContext facesContext, String tableId) {
>          String viewId = StringUtils.split(
> facesContext.getViewRoot().getViewId() , "\\.")[0];
> -        String contextPath =
> facesContext.getExternalContext().getRequestContextPath();
> -        return "window.open('" + contextPath + viewId +
> ".jsf?excelExportTableId=" + tableId + "');return false;";
> +        return "window.open('"
> +                +
> facesContext.getApplication().getViewHandler().getActionURL(
> +                        facesContext, viewId) + "?excelExportTableId="
> +                + tableId + "');return false;";
>      }
>
>
> Index:
>
> /myfaces-current/tomahawk/sandbox/core/src/main/java/org/apache/myfaces/custom/excelexport/ExcelExportPhaseListener.java
> ===================================================================
> ---
>
> /myfaces-current/tomahawk/sandbox/core/src/main/java/org/apache/myfaces/custom/excelexport/ExcelExportPhaseListener.java
> (revision 522807)
> +++
>
> /myfaces-current/tomahawk/sandbox/core/src/main/java/org/apache/myfaces/custom/excelexport/ExcelExportPhaseListener.java
> (working copy)
> @@ -117,6 +117,18 @@
>          cell.setEncoding(HSSFCell.ENCODING_UTF_16);
>          if(component instanceof ValueHolder) {
>              String stringValue =
> RendererUtils.getStringValue(FacesContext.getCurrentInstance(),
> component);
> +            // try some parsings
> +            try {
> +                cell.setCellValue(Double.parseDouble(stringValue));
> +                return;
> +            } catch (NumberFormatException nfe) {
> +            }
> +            try {
> +                cell.setCellNum(Short.parseShort(stringValue));
> +                return;
> +            } catch (NumberFormatException nfe) {
> +            }
> +            // default to string value
>              cell.setCellValue(stringValue);
>          }
>      }
>
>
>
>


-- 
Dennis Byrne

Mime
View raw message