本文介绍了如何在excel中添加图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码我想在单元格的第一行添加图片请帮助解决它,
This is my code I want to add the picture in the first row of the cell please help to resolve it,
CarlosAg.ExcelXmlWriter.Workbook book = new CarlosAg.ExcelXmlWriter.Workbook(); // Specify which Sheet should be opened and the size of window by default
book.ExcelWorkbook.ActiveSheetIndex = 1;
book.ExcelWorkbook.WindowTopX = 100;
book.ExcelWorkbook.WindowTopY = 200;
book.ExcelWorkbook.WindowHeight = 7000;
book.ExcelWorkbook.WindowWidth = 8000;
CarlosAg.ExcelXmlWriter.Worksheet sheet = book.Worksheets.Add(strReportName); // Add a Worksheet with Report name
sheet.Options.PageSetup.Footer.Data = "Powered by Kinetics" + new String(' ', 30) + "Confidential" + new String(' ', 30) + "Page : &P of &N ";
sheet.Options.PageSetup.Layout.Orientation = CarlosAg.ExcelXmlWriter.Orientation.Landscape;
sheet.Options.GridLineColor = "#000000";
for (int intColCnt = 0; intColCnt < 125; intColCnt++) // column settings
{
sheet.Table.Columns.Add(new CarlosAg.ExcelXmlWriter.WorksheetColumn(75));
}
CarlosAg.ExcelXmlWriter.WorksheetRow row = sheet.Table.Rows.Add();
CarlosAg.ExcelXmlWriter.WorksheetCell cell3 = row.Cells.Add("");
row = sheet.Table.Rows.Add();
// row.Cells.Add("images\\actions\\BBlogo.gif");
// row.Cells.Add(" ");
// row.Cells.Add(" ");
string imagepath = Request.PhysicalApplicationPath + "images\\ExertLogo.gif";
book1.addPicture(0, 0, 2, 2, imagepath);
row.Cells.Add(new CarlosAg.ExcelXmlWriter.WorksheetCell(strReportName, "Company"));
row = sheet.Table.Rows.Add();
CarlosAg.ExcelXmlWriter.WorksheetCell cell = row.Cells.Add("");
row.Cells.Insert(1,new CarlosAg.ExcelXmlWriter.WorksheetCell(imagepath));
// row.Cells.Add(imagepath);
// cell.StyleID = "Company";
// cell.MergeAcross = 2;
// row.Cells.Add(" ");
// row.Cells.Add(" ");
row.Cells.Add(new CarlosAg.ExcelXmlWriter.WorksheetCell("Report Run Datetime : " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"), "Reports"));
row = sheet.Table.Rows.Add();
// row.Cells.Add(" ");
// row.Cells.Add(" ");
// row.Cells.Add(" ");
CarlosAg.ExcelXmlWriter.WorksheetCell cell2 = row.Cells.Add();
// cell2.StyleID = "Reports";
// cell2.MergeAcross = 2;
// cell2.MergeDown = 3;
row.Cells.Add(" ");
row.Cells.Add(new CarlosAg.ExcelXmlWriter.WorksheetCell("Report Run By : " + Session["strUsername"].ToString(), "Reports"));
row = sheet.Table.Rows.Add();
row = sheet.Table.Rows.Add();
row = sheet.Table.Rows.Add();
推荐答案
这篇关于如何在excel中添加图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!