C# word 插入图片坐标不固定。
这是主要代码:图片是一页一页的插的//横坐标的数值xxx=-WordDoc.PageSetup.LeftMargin;//纵坐标的数值yyy=WordDoc.PageSe...
这是主要代码: 图片是一页一页的插的
//横坐标的数值
xxx = -WordDoc.PageSetup.LeftMargin;
//纵坐标的数值
yyy = WordDoc.PageSetup.PageHeight - image.Height -WordDoc.PageSetup.HeaderDistance-30;
//取得word总页数
WdStatistic stat = WdStatistic.wdStatisticPages;
//得到word总页数
int numberPage = WordDoc.ComputeStatistics(stat, ref Nothing);
//水印图片循环插入
for (int i = 1; i <= numberPage; i++)
{
//获取每一页
object PageRange = WordApp.Selection.Range.GoTo(1, 1, 1, i);
//插入图片
WordDoc.Application.ActiveDocument.Shapes.AddPicture(picFilePath, true, false, xxx, yyy, image.Width, image.Height, ref PageRange);
}
请高手帮我修改指点一下谢谢! 展开
//横坐标的数值
xxx = -WordDoc.PageSetup.LeftMargin;
//纵坐标的数值
yyy = WordDoc.PageSetup.PageHeight - image.Height -WordDoc.PageSetup.HeaderDistance-30;
//取得word总页数
WdStatistic stat = WdStatistic.wdStatisticPages;
//得到word总页数
int numberPage = WordDoc.ComputeStatistics(stat, ref Nothing);
//水印图片循环插入
for (int i = 1; i <= numberPage; i++)
{
//获取每一页
object PageRange = WordApp.Selection.Range.GoTo(1, 1, 1, i);
//插入图片
WordDoc.Application.ActiveDocument.Shapes.AddPicture(picFilePath, true, false, xxx, yyy, image.Width, image.Height, ref PageRange);
}
请高手帮我修改指点一下谢谢! 展开
2个回答
展开全部
System.Drawing.Font oldFont = richTextBox1.SelectionFont;
if (!oldFont.Italic)
richTextBox1.SelectionFont = new Font(oldFont, oldFont.Style | FontStyle.Italic);
else
richTextBox1.SelectionFont = new Font(oldFont, oldFont.Style &~ FontStyle.Italic);
richTextBox1.Focus();
System.Drawing.Font oldFont = richTextBox1.SelectionFont;
if (!oldFont.Underline)
richTextBox1.SelectionFont = new Font(oldFont, oldFont.Style| FontStyle.Underline);
else
richTextBox1.SelectionFont = new Font(oldFont, oldFont.Style & ~FontStyle.Underline);
richTextBox1.Focus();
System.Drawing.Font oldFont = richTextBox1.SelectionFont;
if (!oldFont.Underline)
richTextBox1.SelectionFont = new Font(oldFont, oldFont.Style| FontStyle.Underline);
else
richTextBox1.SelectionFont = new Font(oldFont, oldFont.Style & ~FontStyle.Underline);
richTextBox1.Focus();
if (!oldFont.Italic)
richTextBox1.SelectionFont = new Font(oldFont, oldFont.Style | FontStyle.Italic);
else
richTextBox1.SelectionFont = new Font(oldFont, oldFont.Style &~ FontStyle.Italic);
richTextBox1.Focus();
System.Drawing.Font oldFont = richTextBox1.SelectionFont;
if (!oldFont.Underline)
richTextBox1.SelectionFont = new Font(oldFont, oldFont.Style| FontStyle.Underline);
else
richTextBox1.SelectionFont = new Font(oldFont, oldFont.Style & ~FontStyle.Underline);
richTextBox1.Focus();
System.Drawing.Font oldFont = richTextBox1.SelectionFont;
if (!oldFont.Underline)
richTextBox1.SelectionFont = new Font(oldFont, oldFont.Style| FontStyle.Underline);
else
richTextBox1.SelectionFont = new Font(oldFont, oldFont.Style & ~FontStyle.Underline);
richTextBox1.Focus();
追问
图片不是自己画的是服务器的图片,直接插入word指定位置就行了,只是页眉顶部插入数据,图片位置就往下面平移
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询