`

手动构建xml xls 日期 datetime number type

    博客分类:
  • java
 
阅读更多
http://ewbi.blogs.com/develops/2005/01/create_excels_s.html

<?xml version="1.0" ?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
  <Styles>
    <Style ss:ID="Default" ss:Name="Normal">
      <Font ss:FontName="Verdana" ss:Size="8" />
    </Style>
    <Style ss:ID="bold">
      <Font ss:FontName="Verdana" ss:Bold="1" />
    </Style>
    <Style ss:ID="date">
      <NumberFormat ss:Format="General Date" />
    </Style>
    <Style ss:ID="mycurrency">
      <Font ss:FontName="Tahoma" ss:Size="10" ss:Bold="1" />
      <NumberFormat ss:Format="&quot;$&quot;#,##0.00" />
    </Style>
    <Style ss:ID="mydate">
      <NumberFormat ss:Format="m/d/yyyy" />
    </Style>
  </Styles>
  <Worksheet ss:Name="Sheet1">
    <Table>
      <Row ss:Index="1">
        <Cell ss:Index="1">
          <Data ss:Type="Number">1</Data>
        </Cell>
        <Cell ss:Index="2" ss:Formula="=R1C1+10">
          <Data ss:Type="Number">11</Data>
        </Cell>
        <Cell ss:Index="3" ss:Formula="=R1C1+20">
          <Data ss:Type="Number"></Data>
        </Cell>
        <Cell ss:Index="4" ss:Formula="=SUM(R1C1:R1C3)" ss:StyleID="mycurrency">
          <Data ss:Type="Number"></Data>
        </Cell>
      </Row>
      <Row ss:Index="2">
        <Cell ss:Index="1">
          <Data ss:Type="Boolean">1</Data>
        </Cell>
      </Row>
      <Row ss:Index="3">
        <Cell ss:Index="1">
          <Data ss:Type="DateTime">2005-01-01T13:54:15.000</Data>
        </Cell>
        <Cell ss:Index="2" ss:StyleID="mydate">
          <Data ss:Type="DateTime">2005-01-02T13:54:15.000</Data>
        </Cell>
        <Cell ss:Index="3" ss:StyleID="date">
          <Data ss:Type="DateTime">2005-01-03T13:54:15.000</Data>
        </Cell>
      </Row>
      <Row ss:Index="4">
        <Cell ss:Index="1">
          <Data ss:Type="String">abc</Data>
        </Cell>
      </Row>
      <Row ss:Index="10">
        <Cell ss:Index="5">
          <Data ss:Type="Error">#N/A</Data>
        </Cell>
      </Row>
    </Table>
  </Worksheet>
  <Worksheet ss:Name="Sheet2">
    <Table>
      <Row ss:Index="1">
        <Cell ss:Index="1" ss:Formula="=Sheet1!R1C1 &amp; &quot; plus text&quot;" ss:StyleID="bold">
          <Data ss:Type="String"></Data>
        </Cell>
      </Row>
    </Table>
  </Worksheet>
</Workbook>
分享到:
评论

相关推荐

    java解析xls

    - 使用`Label`, `Number`, `DateTime`等类根据需要写入文本、数字或日期时间数据。 - 示例代码: ```java Label l = new Label(0, 0, "Header", headerFormat); sheet.addCell(l); ``` #### 五、注意事项 - ...

    java操作excel(jxl)

    6. **处理日期和数字**:JXL库可以识别和处理日期和数字类型的数据,只需设置相应的单元格类型。 ```java Date date = new Date(); WritableCellFormat dateFormat = new WritableCellFormat(new ...

    数据库中Excel导出技术

    tw.WriteLine("&lt;Cell&gt;&lt;Data ss:Type=\"Number\"&gt;" + item.Age + "&lt;/Data&gt;&lt;/Cell&gt;"); // 更多数据列 tw.WriteLine("&lt;/Row&gt;"); } tw.WriteLine("&lt;/Styles&gt;"); tw.WriteLine("&lt;/Workbook&gt;"); httpResponse.Write...

    jxl操作excle

    WritableCellFormat dateFormat = new WritableCellFormat(new jxl.format.DateTime()); Date date = new Date(); Number dateCell = new Number(2, 0, date.getTime(), dateFormat); writableSheet.addCell...

    freemarker资料

    datetime`进行格式化。 ### 8. 国际化(i18n) Freemarker支持多语言,可以通过`&lt;#t&gt;`和`&lt;@i18n&gt;`标签进行国际化资源的访问。 ### 9. 配置管理 Freemarker允许通过`freemarker.template.Configuration`类进行配置...

Global site tag (gtag.js) - Google Analytics