Answer the question
In order to leave comments, you need to log in
How to add an image to an Excel document by placing it under a specific cell?
Hello.
There is a report generated according to the template, the information in the Excel file is loaded using OpenXML.
You need to add several images under certain cells with text, which are added dynamically depending on the data. There are no problems with adding (I took from here polymathprogrammer.com/2010/11/10/how-to-insert-mu... The problem with calculating the position in pixels, i.e. I can’t calculate the coordinates. I
picked up the indent from above:
SheetFormatProperties sheetFormatProperties = worksheetPart.Worksheet.SheetFormatProperties;
double top = 0;
foreach (var row in worksheetPart.Worksheet.GetFirstChild<SheetData>().Elements<Row>())
{
Console.WriteLine("Row: " + row.RowIndex.ToString());
Console.WriteLine(row.Height != null ? row.Height.ToString() : sheetFormatProperties.DefaultRowHeight.ToString());
top += row.Height != null ? row.Height : sheetFormatProperties.DefaultRowHeight;
}
top = top * 12 * 1200;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question