我先是创建了表格,设置第五行列宽对半分;
然后将图片添加到对应单元格后,单元格变形了;
该怎么让其不变形呢?
XWPFTable table = doc.CreateTable(5, 4);
table.Width = 5000;
//设置行高列宽
table.Rows[4].Height = 3000;
CT_TcPr m_Pr = table.GetRow(4).GetCell(0).GetCTTc().AddNewTcPr();
m_Pr.tcW = new CT_TblWidth() { w = "2500", type = ST_TblWidth.dxa };
...
//插入图片
ctp = table.Rows[4].GetCell(0).GetCTTc().GetPList()[0];
XWPFRun run = table.GetRow(4).GetCell(0).GetParagraph(ctp).CreateRun();
table.GetRow(4).GetCell(0).GetParagraph(ctp).Alignment = ParagraphAlignment.CENTER;
var img = new FileStream(tpmc1, FileMode.Open, FileAccess.Read);
run.AddPicture(img, (int)PictureType.JPEG, tplj1[0]["name"], widthPic, heightPic);
img.Close();