当前位置: 首页 > 工具软件 > MyXLS > 使用案例 >

一款使用于sharepoint 的excel报表组件org.in2bits.MyXls

丌官丰羽
2023-12-01

以下是调用方法:

public void GenBudgetRpt(FinBudgetBalanceRptDTO rptObject)
{
rptObject.RptName = "Report name : Budget Balance report";
string formatDate = string.Format("{0:dd/MM/yyyy}", DateTime.Now);
rptObject.CutoffDate = "Cut off date: " + formatDate;
rptObject.Department = "Department: " + rptObject.Department;
XlsReportManager.Send<FinBudgetBalanceRptDTO>(rptObject);
}
[Serializable]
public class FinBudgetBalanceRptDTO
{
public string RptName { get; set; }
public string CutoffDate { get; set; } // temporarliy use LastUpdatedDate
public string Department { get; set; }
public List<FinBudgetBalanceDTO> BudgetBalanceDTOs { get; set; }
}

XlsReportStyleManager和XlsReportManager请看附件.

下面是XlsReportManager会调用的xml文件

<xsl-report name="FIN Budget Summary" type="Report.FinBudgetBalanceRptDTO">
<XF name="XF1">
<Font Bold="true"/>
</XF>
<XF name="XF2">
<Font Bold="true"/>
<HorizontalAlignment value="Centered"/>
</XF>
<XF name="XF3">
<HorizontalAlignment value="Right"/>
</XF>
<Worksheet name="Budgets Report">
<ColumnInfo ColumnIndexStart="0" ColumnIndexEnd="7" Width="4500"></ColumnInfo>
<Cells>
<cell row="1" column="1">
<value name="RptName"/>
</cell>
<cell row="2" column="1">
<value name="CutoffDate"/>
</cell>
<cell row="3" column="1">
<value name="Department"/>
</cell>
<cell row="5" column="1" XF="XF1">Budget code</cell>
<cell row="5" column="2" XF="XF1">Budget name</cell>
<cell row="5" column="3" XF="XF1">Budget owner</cell>
<cell row="5" column="4" XF="XF2">Total budget</cell>
<cell row="5" column="5" XF="XF2">Total ER approved</cell>
<cell row="5" column="6" XF="XF2">ER in process</cell>
<cell row="5" column="7" XF="XF2">Budget balance</cell>
<cell row="5" column="8" XF="XF2">Budget Available</cell>
<muti-cell beginRow="6" column="1">
<list name="BudgetBalanceDTOs" item="BudgetCode"/>
</muti-cell>
<muti-cell beginRow="6" column="2">
<list name="BudgetBalanceDTOs" item="BudgetName"/>
</muti-cell>
<muti-cell beginRow="6" column="3">
<list name="BudgetBalanceDTOs" item="BudgetOwner"/>
</muti-cell>
<muti-cell beginRow="6" column="4" XF="XF3">
<list name="BudgetBalanceDTOs" item="TotalBudget"/>
</muti-cell>
<muti-cell beginRow="6" column="5" XF="XF3">
<list name="BudgetBalanceDTOs" item="TotalERApproved"/>
</muti-cell>
<muti-cell beginRow="6" column="6" XF="XF3">
<list name="BudgetBalanceDTOs" item="ERInProcess"/>
</muti-cell>
<muti-cell beginRow="6" column="7" XF="XF3">
<list name="BudgetBalanceDTOs" item="BudgetBalance"/>
</muti-cell>
<muti-cell beginRow="6" column="8" XF="XF3">
<list name="BudgetBalanceDTOs" item="BudgetAvailable"/>
</muti-cell>
</Cells>
</Worksheet>
</xsl-report>


MyXls.zip

 BTW, 当点击按钮导出xls之后, 无论按任何按钮都会死在那里,解决方法, 在按钮里面加入下script:

function PosExport(obj,msg) {
if (!confirm(msg))
return false;
_spOriginalFormAction = obj.form.action;
_spSuppressFormOnSubmitWrapper = true;
return true;
}

 

 

转载于:https://www.cnblogs.com/Forest-zhu/archive/2011/11/30/2269409.html

 类似资料: