asp.net visio com接口 asp.net和visio混合编程
主要介绍asp.net调用visio com的基本用法,主要用于控制visio图形背景色,文字显示等。
主要步骤:
1、 项目中引用COM组件,找到Mircosoft Visio 14 Type Library(根据Visio版本,14可能有所不同)。
2、 项目编译通常会报错:无法嵌入互操作类型“Microsoft.Office.Interop.Visio.ApplicationClass”。请改用适用的接口。此时将Microsoft.Office.Interop.Visio这个引用右键属性将嵌入互操作类型true改成false。
3、 下面代码完成Visio图中形状底色的改变和图形文字的修改(主要代码):
Document doc = null;
ApplicationClass app = new ApplicationClass();//运行Visio应用程序
string currentPath = Server.MapPath("~/A.vsd ");//文件路径
doc = app.Documents.OpenEx(currentPath, (short)Microsoft.Office.Interop.Visio.VisOpenSaveArgs.visOpenCopy);//打开一个visio文件
Shape shape1 = doc.Pages[1].Shapes["Test"];//此处获取visio中指定名称的形状
shape1.Text = "Hello World";//形状文字修改
shape1.get_CellsU("FillPattern").ResultIU = 1;//设置 背景色时 需设置
shape1.get_CellsU("FillBkgnd").ResultIU = (double)VisDefaultColors.visDarkYellow;//背景色
doc.Close();//关闭打开的文件
app.Quit();//退出Visio应用程序
4、Visio中需打开开发者模式,这样才能给指定形状命名。
5、发布到服务器上需要配置相应的权限,可以参考Excel 组件服务权限配置。
最新文章
- 用Barcode生成条形码图片
- ubuntu为用户增加sudoer权限的两种方法
- java_easyui体系之DataGrid(1)[转]
- Java - 简单的对象排序 - Comparator
- 关灯游戏源码(iOS)
- 获取元素高度及定位js
- c#winform使用WebBrowser 大全[超长文转载]
- ContentProvider使用
- ISE综合后得到的RTL图如何与硬件对应起来,怎么知道每个element的功能
- linux 下的sublime
- Hadoop在linux下无法启动DataNode解决方法
- c++11 auto
- 最锋利的Visual Studio Web开发工具扩展:Web Essentials详解
- Python实现单词查询&;文件查找
- arm swi 软中断 一例
- [转] vue&;webpack多页面配置
- linux 命令 — archive
- [uboot] (第一章)uboot流程——概述
- nginx php
- 【python】安装py3-bencode 及小例程
热门文章
- PrettyProgressBar
- [AngularJS] Using the Angular scope $destroy event and method
- poj 2688 状态压缩dp解tsp
- SSD(固态硬盘)简介
- 果然还是SB了
- ios----protocol, optional ,delegate
- 基于MFC的Opengl实现动画
- 【Shell脚本学习21】Shell break和continue命令
- 社交分享:-canOpenURL: failed for URL: ";weixin://app/*************/"; - error: ";This app is not allowed to query for scheme weixin";
- C语言中的内存压缩技术