hello
I try input image on multi column.
but There is a problem with the width of the image.
I can't set column padding 1pixel
And i set ExcelPicture Width and Height same pixel value,
but result is not same.
thank you.
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
//the image is saved by MS word
Image image = Image.FromFile(@"F:\image\10790Excel.png");
ExcelPicture picture1 = sheet.Pictures.Add(2, 2, image);
picture1.Width = 126;
picture1.Height = 126;
workbook.SaveToFile("10970-1.xlsx", ExcelVersion.Version2013);
Workbook workbook = new Workbook();
workbook.LoadFromFile(@"C:\CreatedByExcel.xlsx");
Worksheet sheet = workbook.Worksheets[0];
//the image is saved by MS word
Image image = Image.FromFile(@"C:\_test_img.bmp");
ExcelPicture picture1 = sheet.Pictures.Add(2, 2, image);
picture1.Width = 126;
picture1.Height = 126;
...
workbook.SaveToFile("CreatedByExcel_result.xlsx", ExcelVersion.Version2013);
Workbook workbook = new Workbook();
workbook.LoadFromFile(@"CreatedByExcel.xlsx");
Worksheet sheet = workbook.Worksheets[0];
Image image = Image.FromFile(@"300x300.png");
// get col 2~3 pixel width
var width = sheet.GetColumnWidthPixels(2) + sheet.GetColumnWidthPixels(3);
sheet.Range[1, 1].Text = "CreatedByExcel.xlsx";
sheet.Range[2, 2].Text = "Image Padding-Right : 0";
ExcelPicture picture1 = sheet.Pictures.Add(3, 2, image);
picture1.Width = width;
picture1.Height = width;
sheet.Range[11, 2].Text = "Image Padding-Right : 1";
ExcelPicture picture2 = sheet.Pictures.Add(12, 2, image);
picture2.Width = width - 1;
picture2.Height = width - 1;
workbook.SaveToFile("CreatedByExcel_result.xlsx", ExcelVersion.Version2013);