當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。