All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Components |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sas.servlet.commands.jdbc.export
Class Util

    com.sas.servlet.commands.jdbc.export.Util

    @SASScope(value="ALL")
    public class Util

Contains utility methods and attributes used by the Export To Excel commands.

Since:
  3.1

Field Summary
`static java.lang.String` | `CHARSET_FOR_HTML_EXPORT_TO_EXCEL` Unicode charset to use to encode the data when exporting to Microsoft Excel in HTML format.
`static java.lang.String` | `CHARSET_FOR_NON_HTML_EXPORT_TO_EXCEL` Unicode charset to use to encode the data when exporting to Microsoft Excel in non HTML format.
`static int` | `REVERSED_BOM_FOR_NON_HTML_EXPORT_TO_EXCEL` Byte-order mark (BOM) to use when exporting in Unicode with `CHARSET_FOR_NON_HTML_EXPORT_TO_EXCEL`.

Constructor Summary
`Util()`

Method Summary
`static void` | `addExcelXMLDirective(BaseTableCell renderer, java.lang.Object rawValue, java.lang.String sasFormatName, java.util.Locale locale, java.lang.String formattedValue, boolean treatNumericCustomFormattedValuesAsText)`
`static void` | `addExcelXMLDirective(BaseTableCell renderer, javax.swing.table.TableModel tm, int rowNumber, int colModelIndex, java.util.Locale locale, java.lang.String customAttributes, java.lang.String formattedValue, boolean treatNumericCustomFormattedValuesAsText)`
`static com.sas.storage.iquery.BusinessQueryToTableModelAdapter` | `createModelWithDisabledOfflineResultSets(com.sas.iquery.metadata.business.BusinessQuery businessQuery, com.sas.iquery.dataretrieval.QueryConnectorInterface queryConnector, java.lang.Boolean dualResultSets)` Return a new BusinessQueryToTableModelAdapter with offline results sets turned off.
`static java.lang.String` | `encodeForExcel(java.lang.String text)` S0632986 Encodes the characters '&', '"', '<', and '>' respectively with '&', '"', '<' and '>'.
`static java.lang.String[]` | `getColumnsToExportAsTextIfCustomFormatted(java.lang.String[] columnUniqueModelIdentifiers, com.sas.iquery.metadata.business.DataItem[] dataItems)` Returns the array of unique model identifiers of columns that should be exported as text if custom formatted.
`static java.lang.String[]` | `getColumnsToNotEncode(com.sas.iquery.metadata.business.DataItem[] dataItems, java.lang.String[] columnUniqueModelIdentifiers)` S0994466 do not encode if data item has "Display as a hyperlink" attribute set to yes.
`static java.lang.String[]` | `getColumnUniqueModelIdentifiers(java.util.Enumeration<TableColumn> columns)` Returns the array of Unique Model Identifiers for a set of TableColumn objects
`static com.sas.iquery.metadata.business.DataItem[]` | `getDataItemsInBusinessQuery(com.sas.iquery.metadata.business.BusinessQuery query)`
`static com.sas.iquery.metadata.business.DataItem[]` | `getDataItemsInTableModel(javax.swing.table.TableModel tm)`
`static java.lang.String` | `getExportFileName(java.lang.String fileExtension)` Returns a randomly generated file name for the file to be exported.
`static java.lang.String` | `getHTMLFooter()` When exporting data to HTML it returns the footer of the html file to export.
`static java.lang.String` | `getHTMLHeader(HTMLExportCSSInfoInterface[] css, java.lang.String styles)` When exporting data to HTML it returns the header of the html file to export.
`static java.lang.String` | `getHTMLNewLineSpan(java.lang.String string)` Generates an HTML 'span' tag on a new line containing the string.
`static boolean` | `isNumericMissingValue(BaseTableView table, java.lang.String value)` S0400309 to export relational missing values as blanks Returns true if the received value is a numeric missing value, otherwise return false.

Field Detail

### CHARSET_FOR_NON_HTML_EXPORT_TO_EXCEL

    public static java.lang.String CHARSET_FOR_NON_HTML_EXPORT_TO_EXCEL

  Unicode charset to use to encode the data when exporting to Microsoft Excel in non HTML format. This charset is to make Microsoft Excel correctly display the characters for the different languages.

### REVERSED_BOM_FOR_NON_HTML_EXPORT_TO_EXCEL

    public static int REVERSED_BOM_FOR_NON_HTML_EXPORT_TO_EXCEL

  Byte-order mark (BOM) to use when exporting in Unicode with `CHARSET_FOR_NON_HTML_EXPORT_TO_EXCEL`. It's called "reversed" because it will be automatically reversed before writing it in the output stream. For example if the expected BOM in the output stream is (in hexadecimal) FFFE, its "reversed" version is FEFF

### CHARSET_FOR_HTML_EXPORT_TO_EXCEL

    public static java.lang.String CHARSET_FOR_HTML_EXPORT_TO_EXCEL

  Unicode charset to use to encode the data when exporting to Microsoft Excel in HTML format. This charset is to make Microsoft Excel correctly display the characters for the different languages.

Constructor Detail

### Util

    public Util()

Method Detail

### getHTMLHeader

    public static java.lang.String getHTMLHeader(HTMLExportCSSInfoInterface[] css,
                                                 java.lang.String styles)

  When exporting data to HTML it returns the header of the html file to export. The returned header includes the style sheets to be exported.

  Parameters:
    `css` - The `HTMLExportCSSInfoInterface` objects that describe the CSS files to be included.
    `styles` - The definitions of the inline style sheets to be included.
  Returns:
    String The header of the html file to export.

### getHTMLFooter

    public static java.lang.String getHTMLFooter()

  When exporting data to HTML it returns the footer of the html file to export.

  Returns:
    String The footer of the html file to export.

### getHTMLNewLineSpan

    public static java.lang.String getHTMLNewLineSpan(java.lang.String string)

  Generates an HTML 'span' tag on a new line containing the string. Something like `
  string` An empty HTML 'span' tag on a new line is generated if the string is either empty or null. Something like `
  `

  Parameters:
    `string` - The string to put inside the 'span' tag
  Returns:
    either `
    string` or `
    `

### getExportFileName

    public static java.lang.String getExportFileName(java.lang.String fileExtension)

  Returns a randomly generated file name for the file to be exported.

  Parameters:
    `fileExtension` - Is appended to the randomly generated file name. Examples of fileExtension are ".xls" or ".csv".
  Returns:
    a randomly generate file name for the file to be exported

### addExcelXMLDirective

    public static void addExcelXMLDirective(BaseTableCell renderer,
                                            java.lang.Object rawValue,
                                            java.lang.String sasFormatName,
                                            java.util.Locale locale,
                                            java.lang.String formattedValue,
                                            boolean treatNumericCustomFormattedValuesAsText)

### addExcelXMLDirective

    public static void addExcelXMLDirective(BaseTableCell renderer,
                                            javax.swing.table.TableModel tm,
                                            int rowNumber,
                                            int colModelIndex,
                                            java.util.Locale locale,
                                            java.lang.String customAttributes,
                                            java.lang.String formattedValue,
                                            boolean treatNumericCustomFormattedValuesAsText)

### createModelWithDisabledOfflineResultSets

    public static com.sas.storage.iquery.BusinessQueryToTableModelAdapter createModelWithDisabledOfflineResultSets(com.sas.iquery.metadata.business.BusinessQuery businessQuery,
                                                                                                                   com.sas.iquery.dataretrieval.QueryConnectorInterface queryConnector,
                                                                                                                   java.lang.Boolean dualResultSets)

  Return a new BusinessQueryToTableModelAdapter with offline results sets turned off.

  Parameters:
    `businessQuery` - the BusinessQuery on which the created adapter is based on. If null, null is returned.
    `queryConnector` - the specific QueryConnectorInterface object the created adapter has to use. If null the adapter will use a new instance of a com.sas.iquery.dataretrieval.QueryConnector object.
    `dualResultSets` - if Boolean#FALSE the created adapter will not use dual result sets, otherwise the created adapter will use the default policy about using/not using dual result sets.
  Returns:
    A new BusinessQueryToTableModelAdapter with offline results sets turned off.
  See Also:
    `BusinessQueryToTableModelAdapter.DEFAULT_POLICY_ON_USING_DUAL_RESULT_SETS`

### isNumericMissingValue

    public static boolean isNumericMissingValue(BaseTableView table,
                                                java.lang.String value)

  S0400309 to export relational missing values as blanks Returns true if the received value is a numeric missing value, otherwise return false.

  Parameters:
    `table` - the TableView used to verify that the current column is numeric.
    `value` - the value to check.
  Returns:
    true if the received value is a numeric missing value, otherwise return false.

### getColumnsToExportAsTextIfCustomFormatted

    public static java.lang.String[] getColumnsToExportAsTextIfCustomFormatted(java.lang.String[] columnUniqueModelIdentifiers,
                                                                               com.sas.iquery.metadata.business.DataItem[] dataItems)

  Returns the array of unique model identifiers of columns that should be exported as text if custom formatted. Null if no column should be exported as text if custom formatted.

  Parameters:
    `columnUniqueModelIdentifiers` - array of column unique model identifiers candidate to be exported as text if custom formatted.
    `tm` -
  Returns:
    the array of unique model identifiers of columns that should be exported as text if custom formatted.

### getColumnUniqueModelIdentifiers

    public static java.lang.String[] getColumnUniqueModelIdentifiers(java.util.Enumeration<TableColumn> columns)

  Returns the array of Unique Model Identifiers for a set of TableColumn objects

  Parameters:
    `columns` - the enumeration of TableColumn objects
  Returns:

### getDataItemsInTableModel

    public static com.sas.iquery.metadata.business.DataItem[] getDataItemsInTableModel(javax.swing.table.TableModel tm)

### getDataItemsInBusinessQuery

    public static com.sas.iquery.metadata.business.DataItem[] getDataItemsInBusinessQuery(com.sas.iquery.metadata.business.BusinessQuery query)

### encodeForExcel

    public static java.lang.String encodeForExcel(java.lang.String text)

  S0632986 Encodes the characters '&', '"', '<', and '>' respectively with '&', '"', '<' and '>'. It does not encode the character '-' into '−' otherwise Excel will treat the '-' character as text instead of as the sign of a numeric value.

  Parameters:
    `text` - the text to be encoded
  Returns:
    the encoded text where any occurrence of the following characters '&', '"', '<', and '>' is encoded respectively with '&', '"', '<' and '>'.

### getColumnsToNotEncode

    public static java.lang.String[] getColumnsToNotEncode(com.sas.iquery.metadata.business.DataItem[] dataItems,
                                                           java.lang.String[] columnUniqueModelIdentifiers)

  S0994466 do not encode if data item has "Display as a hyperlink" attribute set to yes. Returns the array of unique model identifiers of columns whose values should not be encoded when exported to Excel. Null if all columns should be encoded when exported.

  Parameters:
    `dataItems` - array of data items
    `columnUniqueModelIdentifiers` - the set of unique identifiers of the columns from the TableColumnModel
  Returns:
    the array of unique model identifiers of columns that should not be encoded when exported to Excel.

All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Components |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 SAS Institute Inc. All Rights Reserved.