惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Security Archives - TechRepublic
Security Archives - TechRepublic
O
OpenAI News
W
WeLiveSecurity
Hacker News: Ask HN
Hacker News: Ask HN
Hacker News - Newest:
Hacker News - Newest: "LLM"
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
Troy Hunt's Blog
L
LINUX DO - 最新话题
SecWiki News
SecWiki News
Schneier on Security
Schneier on Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
N
News and Events Feed by Topic
TaoSecurity Blog
TaoSecurity Blog
H
Heimdal Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Palo Alto Networks Blog
Project Zero
Project Zero
Attack and Defense Labs
Attack and Defense Labs
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Tor Project blog
Scott Helme
Scott Helme
T
Threat Research - Cisco Blogs
Simon Willison's Weblog
Simon Willison's Weblog
Spread Privacy
Spread Privacy
Cisco Talos Blog
Cisco Talos Blog
T
Threatpost
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
Google DeepMind News
Google DeepMind News
P
Privacy & Cybersecurity Law Blog
Know Your Adversary
Know Your Adversary
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
L
Lohrmann on Cybersecurity
Cloudbric
Cloudbric
I
Intezer
The Hacker News
The Hacker News
L
LINUX DO - 热门话题
AI
AI
B
Blog
S
Securelist
P
Proofpoint News Feed
量子位
Jina AI
Jina AI
V2EX - 技术
V2EX - 技术
T
The Exploit Database - CXSecurity.com
酷 壳 – CoolShell
酷 壳 – CoolShell
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
CERT Recently Published Vulnerability Notes
J
Java Code Geeks
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

博客园 - kwame

CXX0017错误的解决办法 基础知识--is & as 的区别 - kwame 基础知识--变量和常量 - kwame - 博客园 基础知识--Boxing & unBoxing 基础知识--值类型和引用类型 用Visual C#创建Windows服务程序 (转)用C语言编写Windows服务程序的五个步骤 昨天的事今天来写也叫昨天的日记吧?? 我是个被窥视狂? 一个馒头和一个*六*合*彩*网站引发的血案 *六*合*彩*网站也能做成这样不容易呀! 取得一段汉语的每个字的首字母 写入、读取 cookie 无聊顺便复习了下前面学的东西! 网页效果集合(小技巧) Oracle中隐式游标和显式游标的教训[同事的经历] 安装和部署企业程序库(Installation and Deployment of Enterprise Library) OA需要分析3 OA需求分析2 OA需求分析1
C#.net word 受控编程系列1-向word中插入图片
kwame · 2006-03-01 · via 博客园 - kwame

expression.AddPicture(FileName, LinkToFile, SaveWithDocument, Left, Top, Width, Height, Anchor)
Anchor=weboledocument.Selection.Range
可以将你的图片插入到你光标所在的位置

    Word.Document wd = objWinWordControl.document;
                Word.Application wa 
= wd.Application;
                
string fileName="D:\\File0001.jpg";
                
object LinkToFile=false;
                
object SaveWithDocument=true;
                
object Range=Missing.Value;
//                object first=wd.Characters.Count-2;
//                object last=wd.Characters.Count;
                object Left=1;
                
object Top=1;
                
object Width=100;
                
object Height=100;
                
object Anchor=wd.Application.Selection.Range;
                                
                wd.Application.ActiveDocument.Shapes.AddPicture(fileName,
ref LinkToFile,ref SaveWithDocument,ref Left,ref Top,ref Width,ref Height,ref Anchor);
                

下一步就是设置图片的属性了,参考了kingchang2000(镖骑大将)的js文章

=============code==================
/*
------------------------------------------------
描述:将图片插入在文档的末尾
设置图片的位置以及浮动于文字下的版式
参数:myDocApp -- word.application对象
myDoc -- 指定文件对象,
就是myDocApp.ActiveDocument
FilePath -- 文件路径
------------------------------------------------
*/

function InsertSignet(myDocApp,myDoc,FilePath){
try{
var mySel = myDocApp.Selection; 
mySel.EndKey(
6); //类似于ctrl+end功能,到文档的末尾。
var anchor = mySel.Range; //获取所在光标的range对象
//
添加本地图片
var pic = myDoc.Shapes.AddPicture(FilePath,false,true,300,500,100,100,anchor);
//获取wrapformat对象
var picArround = pic.WrapFormat;
//图片成水印状态,设置图片的位置以及浮动于文字下的版式
picArround.Type = 5;
pic.select(); 
//选择图片
}
catch(e){alert("Error:"+e.Description);}
}