本文整理汇总了C#中OpenXmlPowerTools.WmlDocument.SaveAs方法的典型用法代码示例。如果您正苦于以下问题:C# WmlDocument.SaveAs方法的具体用法?C# WmlDocument.SaveAs怎么用?C# WmlDocument.SaveAs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenXmlPowerTools.WmlDocument
的用法示例。
在下文中一共展示了WmlDocument.SaveAs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CU001_ChartUpdater
public void CU001_ChartUpdater(string chartFileName)
{
FileInfo templateFile = new FileInfo(Path.Combine(TestUtil.SourceDir.FullName, chartFileName));
if (templateFile.Extension.ToLower() == ".docx")
{
WmlDocument wmlTemplate = new WmlDocument(templateFile.FullName);
var afterUpdatingDocx = new FileInfo(Path.Combine(TestUtil.TempDir.FullName, templateFile.Name.Replace(".docx", "-processed-by-ChartUpdater.docx")));
wmlTemplate.SaveAs(afterUpdatingDocx.FullName);
using (var wDoc = WordprocessingDocument.Open(afterUpdatingDocx.FullName, true))
{
var chart1Data = new ChartData
{
SeriesNames = new[] {
"Car",
"Truck",
"Van",
"Bike",
"Boat",
},
CategoryDataType = ChartDataType.String,
CategoryNames = new[] {
"Q1",
"Q2",
"Q3",
"Q4",
},
Values = new double[][] {
new double[] {
100, 310, 220, 450,
},
new double[] {
200, 300, 350, 411,
},
new double[] {
80, 120, 140, 600,
},
new double[] {
120, 100, 140, 400,
},
new double[] {
200, 210, 210, 480,
},
},
};
ChartUpdater.UpdateChart(wDoc, "Chart1", chart1Data);
var chart2Data = new ChartData
{
SeriesNames = new[] {
"Series"
},
CategoryDataType = ChartDataType.String,
CategoryNames = new[] {
"Cars",
"Trucks",
"Vans",
"Boats",
},
Values = new double[][] {
new double[] {
320, 112, 64, 80,
},
},
};
ChartUpdater.UpdateChart(wDoc, "Chart2", chart2Data);
var chart3Data = new ChartData
{
SeriesNames = new[] {
"X1",
"X2",
"X3",
"X4",
"X5",
"X6",
},
CategoryDataType = ChartDataType.String,
CategoryNames = new[] {
"Y1",
"Y2",
"Y3",
"Y4",
"Y5",
"Y6",
},
Values = new double[][] {
new double[] { 3.0, 2.1, .7, .7, 2.1, 3.0, },
new double[] { 3.0, 2.1, .8, .8, 2.1, 3.0, },
new double[] { 3.0, 2.4, 1.2, 1.2, 2.4, 3.0, },
new double[] { 3.0, 2.7, 1.7, 1.7, 2.7, 3.0, },
new double[] { 3.0, 2.9, 2.5, 2.5, 2.9, 3.0, },
new double[] { 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, },
},
};
ChartUpdater.UpdateChart(wDoc, "Chart3", chart3Data);
var chart4Data = new ChartData
//.........这里部分代码省略.........