积极答复者
设置excel单元格高度

问题
答案
-
jujubee, 你其实可以试下一些第三方excel类库,它们很多都支持的,比如这个,下载后添加reference到程序中,
range.RowHeight = img.Height * 141 / 188;
就可以了。
完整代码参考这里:
Workbook wb = new Workbook(); Worksheet ws = wb.Worksheets[0]; Image img = Image.FromFile("02.png"); CellRange range = ws.Range["A1"]; //Spire.Xls measured the row height with points, not pixels, so I make a conversion here range.RowHeight = img.Height * 141 / 188; ws.Pictures.Add(1, 1, img); wb.SaveToFile("Sample.xlsx", ExcelVersion.Version2010);
- 已标记为答案 CaillenModerator 2015年4月27日 8:34
-
你好:
尝试一下这个帖子中的示例代码:
How to programmatically add a Picture or Icon to an Excel WorkSheet using C#
设置单元格高度的话可以使用这个属性设置:
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- 已标记为答案 CaillenModerator 2015年4月27日 8:34
全部回复
-
jujubee, 你其实可以试下一些第三方excel类库,它们很多都支持的,比如这个,下载后添加reference到程序中,
range.RowHeight = img.Height * 141 / 188;
就可以了。
完整代码参考这里:
Workbook wb = new Workbook(); Worksheet ws = wb.Worksheets[0]; Image img = Image.FromFile("02.png"); CellRange range = ws.Range["A1"]; //Spire.Xls measured the row height with points, not pixels, so I make a conversion here range.RowHeight = img.Height * 141 / 188; ws.Pictures.Add(1, 1, img); wb.SaveToFile("Sample.xlsx", ExcelVersion.Version2010);
- 已标记为答案 CaillenModerator 2015年4月27日 8:34
-
你好:
尝试一下这个帖子中的示例代码:
How to programmatically add a Picture or Icon to an Excel WorkSheet using C#
设置单元格高度的话可以使用这个属性设置:
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- 已标记为答案 CaillenModerator 2015年4月27日 8:34