【仅供内部供应商使用,不提供对外解答和培训】

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

前言

在插件开发中,遇到需要持久化对象或者保存配置信息的情况,就需要读写xml文件。

示例

我们以在WorkBook对象中扩展IOFileAttrMark属性为例子:

一个完全空的模板,其xml文件(即cpt文件)大致为下面的样子

模板的xml文件
<?xml version="1.0" encoding="UTF-8"?>
<WorkBook xmlVersion="20151125" releaseVersion="8.0.0">
<Report class="com.fr.report.worksheet.WorkSheet" name="sheet1">
<ReportPageAttr>
<HR/>
<FR/>
<HC/>
<FC/>
</ReportPageAttr>
<ColumnPrivilegeControl/>
<RowPrivilegeControl/>
<RowHeight defaultValue="723900">
<![CDATA[723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900]]></RowHeight>
<ColumnWidth defaultValue="2743200">
<![CDATA[2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200]]></ColumnWidth>
<CellElementList>
<C c="0" r="0">
<PrivilegeControl/>
<Expand/>
</C>
</CellElementList>
<ReportAttrSet>
<ReportSettings headerHeight="0" footerHeight="0">
<PaperSetting/>
</ReportSettings>
</ReportAttrSet>
<PrivilegeControl/>
</Report>
<StyleList/>
<DesignerVersion DesignerVersion="IAA"/>
<PreviewType PreviewType="0"/>
</WorkBook>

我们略去所有空的和不重要的节点,大概就是这样

忽略不重要节点后的xml文件
<?xml version="1.0" encoding="UTF-8"?>
<WorkBook xmlVersion="20151125" releaseVersion="8.0.0">
<Report class="com.fr.report.worksheet.WorkSheet" name="sheet1">
<DesignerVersion DesignerVersion="IAA"/>
<PreviewType PreviewType="0"/>
</WorkBook>
  • No labels