本文整理汇总了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));
}
示例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));
}