当前位置: 首页>>代码示例>>C#>>正文


C# WmlDocument.SaveAs方法代码示例

本文整理汇总了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
//.........这里部分代码省略.........
开发者ID:BogdanDamianC,项目名称:Open-Xml-PowerTools,代码行数:101,代码来源:ChartUpdaterTests.cs


注:本文中的OpenXmlPowerTools.WmlDocument.SaveAs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。