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

推荐订阅源

T
The Blog of Author Tim Ferriss
S
Securelist
D
Docker
The Register - Security
The Register - Security
GbyAI
GbyAI
Recorded Future
Recorded Future
Engineering at Meta
Engineering at Meta
Stack Overflow Blog
Stack Overflow Blog
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
罗磊的独立博客
博客园 - 【当耐特】
F
Full Disclosure
WordPress大学
WordPress大学
腾讯CDC
小众软件
小众软件
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
SecWiki News
SecWiki News
L
Lohrmann on Cybersecurity
I
InfoQ
MyScale Blog
MyScale Blog
量子位
Cyberwarzone
Cyberwarzone
博客园 - 三生石上(FineUI控件)
The Hacker News
The Hacker News
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Jina AI
Jina AI
博客园_首页
H
Help Net Security
K
Kaspersky official blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Webroot Blog
Webroot Blog
Blog — PlanetScale
Blog — PlanetScale
V
Vulnerabilities – Threatpost
Y
Y Combinator Blog
The Cloudflare Blog
P
Proofpoint News Feed
V
Visual Studio Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tailwind CSS Blog
爱范儿
爱范儿
P
Privacy International News Feed
Security Archives - TechRepublic
Security Archives - TechRepublic
The GitHub Blog
The GitHub Blog
C
Cybersecurity and Infrastructure Security Agency CISA
B
Blog RSS Feed

博客园 - 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);}
}