C#如何向Excel中插入图片 现在想向excel中插入图片,希望大家给点思路,最好能提供些源码参考,谢谢了! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Excel.Worksheet xSheet=( Excel.Worksheet)xBook.Sheets[1]; xSheet.Shapes.AddPicture("D:\\tt.bmp", MsoTriState.msoFalse , MsoTriState.msoTrue,10,10,150,150); IEnumerator enumerator1 = inlineShapes.GetEnumerator(); enumerator1.Reset(); enumerator1.MoveNext(); InlineShape inlineShape = enumerator1.Current as InlineShape; Shape curShape = inlineShape.ConvertToShape(); enumerator1 = null; if (curShape == null) return; object left = curShape.Left; object top = curShape.Top; object width = curShape.Width; object height = curShape.Height; object anchor = curShape.Anchor; object missing = Type.Missing; Word.Shape newShape = shapes.AddPicture(imageName, ref missing, ref missing, ref left, ref top, ref width, ref height, ref anchor); curShape.Delete(); 插入 文字 你就要在word模版中 建立你要的文字型窗体域我这些代码都是office 2000的/// <summary> /// 填充Word文件的字段值 /// </summary> /// <param name="fieldName">字段名</param> /// <param name="newValue">要显示的字段名的具体值</param>public void FillFieldValueToWord(string fieldName, string newValue) { Object itemName = fieldName; Word.FormField field = formFields.Item(ref itemName); if (field == null) return; string strResult = field.Result.ToString(); string fieldValue = newValue; // 对于不够长度的在后面加空格 if (strResult.Length > newValue.Length) fieldValue = fieldValue.PadRight(strResult.Length,' '); field.Result = fieldValue; } Excel和Word的操作有何区别呢? 关注和学习中,碰到了和你相似的问题希望将一群图片和相对应的文字生成Excel表 myApp.exe.config文件 在线好友是什么原理,比如用户数量很大的情况。 C#引用类型数据成员的定义方式 怎樣使用C#中Combox控件設置為平面效果? T_SQL语句在sql2000中运行正常,但是在ACCESS中报错 你觉得下围棋对于程序员来说,有特别的意义吗? windows服务如何打包呀??? 如何将DATAGRID的数据导入到Excel中 C#使用托管C++中出现的问题。 list<>做函数参数,类型不确定怎么声明 为什么C#的Main函数是静态的? datalist问题,好人帮忙呀(谢谢呀)
xSheet.Shapes.AddPicture("D:\\tt.bmp", MsoTriState.msoFalse ,
MsoTriState.msoTrue,10,10,150,150);
enumerator1.Reset();
enumerator1.MoveNext();
InlineShape inlineShape = enumerator1.Current as InlineShape;
Shape curShape = inlineShape.ConvertToShape();
enumerator1 = null;
if (curShape == null) return;
object left = curShape.Left;
object top = curShape.Top;
object width = curShape.Width;
object height = curShape.Height;
object anchor = curShape.Anchor;
object missing = Type.Missing;
Word.Shape newShape = shapes.AddPicture(imageName, ref missing, ref missing,
ref left, ref top, ref width, ref height, ref anchor);
curShape.Delete();
我这些代码都是office 2000的
/// <summary>
/// 填充Word文件的字段值
/// </summary>
/// <param name="fieldName">字段名</param>
/// <param name="newValue">要显示的字段名的具体值</param>
public void FillFieldValueToWord(string fieldName, string newValue)
{
Object itemName = fieldName;
Word.FormField field = formFields.Item(ref itemName);
if (field == null) return; string strResult = field.Result.ToString();
string fieldValue = newValue; // 对于不够长度的在后面加空格
if (strResult.Length > newValue.Length)
fieldValue = fieldValue.PadRight(strResult.Length,' '); field.Result = fieldValue;
}
希望将一群图片和相对应的文字生成Excel表