Package org.formulacompiler.spreadsheet.internal.excel.xlsx.xml

Examples of org.formulacompiler.spreadsheet.internal.excel.xlsx.xml.XmlNode


  private int createNamedStyle( String _name )
  {
    final int baseStyleId = createBaseStyle();
    this.namedStyles.put( _name, baseStyleId );

    final XmlNode node = new XmlNode( XMLConstants.Main.NAMED_STYLE );
    node.addAttribute( XMLConstants.Main.FORMAT_STYLE_ID, Integer.toString( baseStyleId ) );
    node.addAttribute( XMLConstants.Main.NAMED_STYLE_NAME, _name );
    this.xmlCellStyles.add( node );

    return baseStyleId;
  }
View Full Code Here


    return baseStyleId;
  }

  private int createCellStyle( int _baseStyleId, boolean _isDate, boolean _isTime )
  {
    final XmlNode node = this.xmlCellStyleXfs.get( _baseStyleId ).clone();
    final Style style;
    if (!_isDate && !_isTime) {
      style = new Style( _baseStyleId, NumberFormat.getPredefinedNumberFormat( "0" ), false );

      node.addAttribute( XMLConstants.Main.FORMAT_STYLE_ID, Integer.toString( _baseStyleId ) );
    }
    else {
      final int numberFormatId;
      if (_isDate)
        if (_isTime)
          numberFormatId = DEFAULT_DATETIME_NF;
        else
          numberFormatId = DEFAULT_DATE_NF;
      else
        numberFormatId = DEFAULT_TIME_NF;

      style = new Style( _baseStyleId, NumberFormat.getPredefinedNumberFormat( numberFormatId ), true );

      node.addAttribute( XMLConstants.Main.FORMAT_STYLE_ID, Integer.toString( _baseStyleId ) );
      node.addAttribute( XMLConstants.Main.FORMAT_APPLY_NUMBER_FORMAT, XMLConstants.TRUE );
      node.addAttribute( XMLConstants.Main.NUMBER_FORMAT_ID, Integer.toString( numberFormatId ) );
    }

    this.styles.add( style );
    this.xmlCellXfs.add( node );
    return this.xmlCellXfs.size() - 1;
View Full Code Here

  private void write( final List<XmlNode> _styles ) throws XMLStreamException
  {
    final int count = _styles.size();
    for (int i = 0; i != count; i++) {
      final XmlNode node = _styles.get( i );
      write( node );
    }
  }
View Full Code Here

    }
  }

  protected final XmlNode readEvents( StartElement _se ) throws XMLStreamException
  {
    final XmlNode node = new XmlNode( _se );

    while (this.xmlEventReader.hasNext()) {
      final XMLEvent event = this.xmlEventReader.nextEvent();
      if (event.isEndElement()) {
        this.cursor.pop();
        return node;
      }
      if (event.isStartElement()) {
        StartElement se = event.asStartElement();
        this.cursor.push( se.getName() );
        node.addChild( new XmlNode( se ) );
      }
    }
    throw new XMLStreamException( "Element end not found." );
  }
View Full Code Here

TOP

Related Classes of org.formulacompiler.spreadsheet.internal.excel.xlsx.xml.XmlNode

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.