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


C# Microsoft.Office.Interop.Visio.Export方法代码示例

本文整理汇总了C#中Microsoft.Office.Interop.Visio.Export方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Office.Interop.Visio.Export方法的具体用法?C# Microsoft.Office.Interop.Visio.Export怎么用?C# Microsoft.Office.Interop.Visio.Export使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Office.Interop.Visio的用法示例。


在下文中一共展示了Microsoft.Office.Interop.Visio.Export方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExportSelectionToXAML

        public static void ExportSelectionToXAML(IVisio.Selection sel, string filename, System.Action<string> verboselog)
        {
            // Save temp SVG
            string svg_filename = System.IO.Path.GetTempFileName() + "_temp.svg";
            sel.Export(svg_filename);

            // Load temp SVG
            var load_svg_timer = new System.Diagnostics.Stopwatch();
            string input_svg_content = System.IO.File.ReadAllText(svg_filename);
            load_svg_timer.Stop();
            verboselog(string.Format("Finished SVG Loading ({0} seconds)", load_svg_timer.Elapsed.TotalSeconds));

            // Delete temp SVG
            if (System.IO.File.Exists(svg_filename))
            {
                System.IO.File.Delete(svg_filename);
            }
            else
            {
                string msg = string.Format("Temporary SVG file could not be found: \"{0}\"", svg_filename);
                throw new VisioAutomation.Scripting.VisioOperationException(msg);
            }

            verboselog("Creating XHTML with embedded SVG");

            if (System.IO.File.Exists(filename))
            {
                verboselog(string.Format("Deleting \"{0}\"", filename));
                System.IO.File.Delete(filename);
            }

            verboselog("Converting to XAML ...");
            var convert_timer = new System.Diagnostics.Stopwatch();

            string xaml;
            try
            {
                xaml = XamlTuneConverter.Svg2Xaml.ConvertFromSVG(input_svg_content);
            }
            catch (System.Exception e)
            {
                string msg = string.Format("Failed to convert to XAML \"{0}\"", e.Message + e.StackTrace);
                verboselog(msg);
                return;
            }
            convert_timer.Stop();

            verboselog("Writing XAML File");
            System.IO.File.WriteAllText(filename, xaml);
            verboselog("Finished writing XAML File");

            verboselog(string.Format("Finished XAML export ({0} seconds)", convert_timer.Elapsed.TotalSeconds));
        }
开发者ID:modulexcite,项目名称:Visio-Power-Tools,代码行数:53,代码来源:XamlUtil.cs

示例2: SelectionToSVGXHTML

        private void SelectionToSVGXHTML(IVisio.Selection selection, string filename, System.Action<string> verboselog)
        {
            this.AssertApplicationAvailable();
            this.AssertDocumentAvailable();

            // Save temp SVG
            string svg_filename = System.IO.Path.GetTempFileName() + "_temp.svg";
            selection.Export(svg_filename);

            // Load temp SVG
            var load_svg_timer = new System.Diagnostics.Stopwatch();
            var svg_doc = SXL.XDocument.Load(svg_filename);
            load_svg_timer.Stop();
            verboselog(string.Format("Finished SVG Loading ({0} seconds)", load_svg_timer.Elapsed.TotalSeconds));

            // Delete temp SVG
            if (System.IO.File.Exists(svg_filename))
            {
                System.IO.File.Delete(svg_filename);
            }
            else
            {
                // TODO: throw an exception
            }

            verboselog(string.Format("Creating XHTML with embedded SVG"));
            var s = svg_filename;

            if (System.IO.File.Exists(filename))
            {
                verboselog(string.Format("Deleting \"{0}\"", filename));
                System.IO.File.Delete(filename);
            }

            var xhtml_doc = new SXL.XDocument();
            var xhtml_root = new SXL.XElement("{http://www.w3.org/1999/xhtml}html");
            xhtml_doc.Add(xhtml_root);
            var svg_node = svg_doc.Root;
            svg_node.Remove();

            var body = new SXL.XElement("{http://www.w3.org/1999/xhtml}body");
            xhtml_root.Add(body);
            body.Add(svg_node);

            xhtml_doc.Save(filename);
            verboselog(string.Format("Done writing XHTML file \"{0}\"", filename));
        }
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:47,代码来源:ExportCommands.cs


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