昨天刚误删微信聊天记录误删恢复,怎么恢复,我是安卓手机

当前位置: >
SVG格式转Visio的vsd格式方法,附带C#动态调用Office的Com组件方法
来源:CNBLOGS & 发布时间:
& 作者:网友 &
浏览次数:
摘要: SVG格式可以直接显示在网页上面,用来实现诸如统计Chart图表、流程图、组织结构图的功能。为了使图像可以下载下来以便于修改,...
SVG格式可以直接显示在网页上面,用来实现诸如统计Chart图表、流程图、组织结构图的功能。为了使图像可以下载下来以便于修改,可以将SVG转为Visio的vsd格式。方法很简单,主要是使用Visio组件自带的方法,先打开svg文件,然后另存为vsd文件。调用方法如下:
/// &summary&
/// svg转vsd
/// &/summary&
/// &param name="svgFn"&svn文件名&/param&
/// &param name="desVsdFn"&输出的vsd文件名&/param&
private static void Svg2Vsd(string svgFn, string desVsdFn)
var app = ComObj.Create("Visio.Application");
app["Visible"] = new ComObj(false);
var docs = app["Documents"];
short visOpenHidden = <span style="line-height:150%;font-family:Courier Nfont-size:12line-height:1.5;color: #, visOpenRO = <span style="line-height:150%;font-family:Courier Nfont-size:12line-height:1.5;color: #;
var doc = docs.Call("OpenEx", svgFn, visOpenHidden + visOpenRO);
doc.Call("SaveAs", desVsdFn);
doc.Call("Close");
app.Call("Quit");
这里用到了一个我自己写的ComObj类,其作用是为了便于通过反射来调用诸如Office之类的Com组件,并且使调用时的代码简洁明了!
为什么要用反射的方式来动态调用,而不采用直接引用Com组件的方式呢?主要是为了减少程序代码对Com组件的依赖耦合,从而方便代码的编译和发布部署。动态调用的方式,可以不添加组件的引用,就能编译、运行。如果服务器未安装这个Com组件,也可以进行直观的提示,而不是程序出错。
这个类的代码如下:
using System.R
namespace HZ.Common
/// &summary&
/// 用于方便对Com对象的属性、方法调用
/// &/summary&
public class ComObj
public static ComObj Create(string progId)
var type = Type.GetTypeFromProgID(progId);
if (type == null)
throw new Exception("服务器需要安装" + progId + "才能使用此功能");
return new ComObj(Activator.CreateInstance(type));
private object _
/// &summary&
/// 实际的值
/// &/summary&
public object Val
get { return _ }
public ComObj(object comObject)
_val = comO
public ComObj Call(string mehtod, params object[] args)
if (_val == null)
return null;
var ret = _val.GetType().InvokeMember(mehtod, BindingFlags.InvokeMethod, null, _val, args);
return new ComObj(ret);
public ComObj this[string property]
if (_val == null)
return null;
var ret = _val.GetType().InvokeMember(property, BindingFlags.GetProperty, null, _val, null);
return new ComObj(ret);
if (_val != null)
_val.GetType().InvokeMember(property, BindingFlags.SetProperty, null, _val, new object[] { value.Val });
上一篇:没有了
我来说两句
友情链接:你正在使用的浏览器版本过低,将不能正常浏览和使用知乎。Libvisio2svg. Library/Tools to Convert MS Visio .VSS/.VSD Docs to SVG - 推酷
Libvisio2svg. Library/Tools to Convert MS Visio .VSS/.VSD Docs to SVG
Libvisio2svg
Library/Utilities to convert Microsoft (MS) Visio Documents and Stencils (VSS and VSD) to SVG.
Motivation
There are tons of publicly available MS Visio stencils, for example
or the stencils from
This library and utilities were created to be able to convert these stencils to SVG and reuse them outside of Microsoft Visio, in programs like
This library is mainly the glue between
/libvisio andlibemf2svg.
About libemf2svg
libemf2svg is another library of mine. It was developed to handle MS EMF (Enhanced Metafile) blobs which constitute most of Visio VSS shapes.
Librevenge/Libvisio would otherwise only dump the EMF blob as base64 in an &image& SVG tag, which most viewer/editor/browser would be unable to display.
Libvisio2svg is licensed under GPLv2.
Dependencies
Commands to build this project:
# CMAKE_INSTALL_PREFIX is optional, default is /usr/local/
$ cmake . -DCMAKE_INSTALL_PREFIX=/usr/
# compilation
# installation
$ make install
Command Line
Convert VSS:
# conversion
$ vss2svg-conv -i ./2960CX.vss -o ./out/
'Cisco R42610 Front.svg'
'WS-C2960CX-8PC-L Rear.svg'
'WS-C2960CX-8TC-L Rear.svg'
'WS-C2960CX-8PC-L Front.svg'
'WS-C2960CX-8TC-L Front.svg'
$ vss2svg-conv --help
Convert VSD:
# conversion
$ vsd2svg-conv -i ./my.VSD -o ./out/
Page-1.svg
Page-2.svg
Page-3.svg
Page-4.svg
$ vsd2svg-conv --help
Convert Visio Documents:
#include &string&
#include &stdlib.h&
#include &sys/types.h&
#include &visio2svg/Visio2Svg.h&
#include &unordered_map&
// Put visio file in an std::string (not detailed here)
std::string visio_
// Initialize converter and output map
visio2svg::Visio2S
std::unordered_map&std::string, std::string&
// Pick one of the following
// Convert vsd documents
converter.vsd2svg(visio_in, out);
// Convert vss (Stencils) documents
converter.vss2svg(visio_in, out);
// Do something with the output
for (const auto &rule_pair : out) {
cout && &Sheet Title: & && rule_pair.first &&std::
cout && rule_pair.second && std::
This library also comes with a RVNG generator to recover sheets titles:
#include &librevenge-stream/librevenge-stream.h&
#include &librevenge-generators/librevenge-generators.h&
#include &librevenge/librevenge.h&
#include &libvisio/libvisio.h&
#include &visio2svg/TitleGenerator.h&
// put the Visio document in an RVNGStream (not detailed here)
librevenge::RVNGStringS
/* or from file
librevenge::RVNGFileS
// Recover Titles of each sheets
librevenge::RVNGStringVector output_
visio2svg::TitleGenerator generator_names(output_names);
ret = libvisio::VisioDocument::parseStencils(&input, &generator_names);
/* or this for vsd
ret = libvisio::VisioDocument::parse(&input, &generator_names);
if (!ret || output_names.empty()) {
std::cerr && &ERROR: Failed to recover sheets titles failed!&
// do something with the names
for (unsigned k = 0; k & output_names.size(); ++k) {
std::cout && output_names[k].cstr() && std::
已发表评论数()
请填写推刊名
描述不能大于100个字符!
权限设置: 公开
仅自己可见
正文不准确
标题不准确
排版有问题
主题不准确
没有分页内容
图片无法显示
视频无法显示
与原文不一致

我要回帖

更多关于 苹果微信聊天记录误删 的文章

 

随机推荐