Package org.openoffice.odf.doc

Examples of org.openoffice.odf.doc.OdfSpreadsheetDocument


        int binaryEncoding = coreStore.getInt( BrowserCoreConstants.PREFERENCE_FORMAT_ODF_BINARYENCODING );

        // export
        try
        {
            OdfSpreadsheetDocument doc = OdfSpreadsheetDocument.createSpreadsheetDocument();
            OdfFileDom contentDoc = doc.getContentDom();

            // Remove the default table added in construction
            Element spreadsheetElement = ( Element ) contentDoc.getElementsByTagNameNS( OdfNamespace.OFFICE.getUri(),
                "spreadsheet" ).item( 0 );
            OdfTable table = ( OdfTable ) ( spreadsheetElement.getElementsByTagNameNS( OdfNamespace.TABLE.getUri(),
                "table" ).item( 0 ) );
            table.getParentNode().removeChild( table );

            // create the table
            table = new OdfTable( contentDoc );
            table.setName( "Export" ); //$NON-NLS-1$
            Element officeSpreadsheet = ( Element ) contentDoc.getElementsByTagNameNS( OdfNamespace.OFFICE.getUri(),
                "spreadsheet" ).item( 0 );
            officeSpreadsheet.appendChild( table );

            // header
            OdfTableRow headerRow = new OdfTableRow( contentDoc );
            table.appendChild( headerRow );
            LinkedHashMap<String, Short> attributeNameMap = new LinkedHashMap<String, Short>();
            if ( this.exportDn )
            {
                short cellNum = ( short ) 0;
                //attributeNameMap.put( "dn", new Short( cellNum ) ); //$NON-NLS-1$
                OdfTableCell cell = new OdfTableCell( contentDoc );
                cell.setValueType( OdfValueType.STRING );
                cell.setStringValue( "dn" ); //$NON-NLS-1$
                headerRow.appendCell( cell );
            }

            // max export
            if ( searchParameter.getCountLimit() < 1 || searchParameter.getCountLimit() > MAX_COUNT_LIMIT )
            {
                searchParameter.setCountLimit( MAX_COUNT_LIMIT );
            }

            int count = 0;
            exportToOdf( browserConnection, searchParameter, contentDoc, table, headerRow, count, monitor,
                attributeNameMap, valueDelimiter, binaryEncoding, this.exportDn );

            doc.save( exportOdfFilename );
        }
        catch ( Exception e )
        {
            monitor.reportError( e );
        }
View Full Code Here


        int binaryEncoding = coreStore.getInt( BrowserCoreConstants.PREFERENCE_FORMAT_ODF_BINARYENCODING );

        // export
        try
        {
            OdfSpreadsheetDocument doc = OdfSpreadsheetDocument.createSpreadsheetDocument();
            OdfFileDom contentDoc = doc.getContentDom();

            // Remove the default table added in construction
            Element spreadsheetElement = ( Element ) contentDoc.getElementsByTagNameNS( OdfNamespace.OFFICE.getUri(),
                "spreadsheet" ).item( 0 ); //$NON-NLS-1$
            OdfTable table = ( OdfTable ) ( spreadsheetElement.getElementsByTagNameNS( OdfNamespace.TABLE.getUri(),
                "table" ).item( 0 ) ); //$NON-NLS-1$
            table.getParentNode().removeChild( table );

            // create the table
            table = new OdfTable( contentDoc );
            table.setName( "Export" ); //$NON-NLS-1$
            Element officeSpreadsheet = ( Element ) contentDoc.getElementsByTagNameNS( OdfNamespace.OFFICE.getUri(),
                "spreadsheet" ).item( 0 ); //$NON-NLS-1$
            officeSpreadsheet.appendChild( table );

            // header
            OdfTableRow headerRow = new OdfTableRow( contentDoc );
            table.appendChild( headerRow );
            LinkedHashMap<String, Short> attributeNameMap = new LinkedHashMap<String, Short>();
            if ( this.exportDn )
            {
                //                short cellNum = ( short ) 0;
                //attributeNameMap.put( "dn", new Short( cellNum ) ); //$NON-NLS-1$
                OdfTableCell cell = new OdfTableCell( contentDoc );
                cell.setValueType( OdfValueType.STRING );
                cell.setStringValue( "dn" ); //$NON-NLS-1$
                headerRow.appendCell( cell );
            }

            // max export
            if ( searchParameter.getCountLimit() < 1 || searchParameter.getCountLimit() > MAX_COUNT_LIMIT )
            {
                searchParameter.setCountLimit( MAX_COUNT_LIMIT );
            }

            int count = 0;
            exportToOdf( browserConnection, searchParameter, contentDoc, table, headerRow, count, monitor,
                attributeNameMap, valueDelimiter, binaryEncoding, this.exportDn );

            doc.save( exportOdfFilename );
        }
        catch ( Exception e )
        {
            monitor.reportError( e );
        }
View Full Code Here

TOP

Related Classes of org.openoffice.odf.doc.OdfSpreadsheetDocument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.