如何用 c#插入多张图片到word里面,我的代码只会每次都覆盖旧图片,没怎么学过c#,都是网上复制粘贴写的,求代#码告知,谢谢
private void button4_Click_1(object sender, EventArgs e)
{
openFileDialog1.Filter = "*.png|*.png|*.jpg|*.jpg|*.bmp|*.bmp*";
DialogResult dr = openFileDialog1.ShowDialog();
int i = 0;
if (dr == DialogResult.OK)
{
pictureBox1.Visible = true;
pictureBox1.Image = new Bitmap(openFileDialog1.FileName);
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
listBox2.Items.Add(openFileDialog1.FileName);
Spire.Doc.Document doc = new Spire.Doc.Document();
//添加section和段落
Spire.Doc.Section section = doc.AddSection();
Spire.Doc.Documents.Paragraph para = section.AddParagraph();
//加载图片到System.Drawing.Image对象, 使用AppendPicture方法将图片插入到段落
DocPicture picture = doc.Sections[0].Paragraphs[0].AppendPicture(pictureBox1.Image); //还有这段的section【0】。paragraph【0】什么意思
//保存到文档
doc.SaveToFile("C:\\Image.doc", FileFormat.Doc);
}
}