From a33b575760d1d252e6ed6521496c2672259bd7ca Mon Sep 17 00:00:00 2001 From: VinothSF5015 Date: Thu, 7 May 2026 17:25:26 +0530 Subject: [PATCH] 1010770 - Content Modified --- ...icture-into-a-cell-in-an-excel-document.md | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-insert-a-picture-into-a-cell-in-an-excel-document.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-insert-a-picture-into-a-cell-in-an-excel-document.md index 2f23e372fb..b90e62bfb7 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-insert-a-picture-into-a-cell-in-an-excel-document.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-insert-a-picture-into-a-cell-in-an-excel-document.md @@ -11,6 +11,28 @@ documentation: UG The following code example illustrates how to insert a picture into a cell in an Excel document. {% tabs %} +{% highlight c# tabtitle="C# [Cross-platform]" %} +using (ExcelEngine excelEngine = new ExcelEngine()) +{ + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + IWorkbook workbook = application.Workbooks.Create(1); + IWorksheet worksheet = workbook.Worksheets[0]; + + //Adding a picture + FileStream imageStream = new FileStream(Path.GetFullPath(@"Data/Image.png"), FileMode.Open, FileAccess.Read); + IPictureShape shape = worksheet.Pictures.AddPicture(1, 1, imageStream); + + #region Save + //Saving the workbook + workbook.SaveAs(Path.GetFullPath("Output/AddPicture.xlsx")); + #endregion + + //Dispose streams + imageStream.Dispose(); +} +{% endhighlight %} + {% highlight c# tabtitle="C# [Windows-specific]" %} using (ExcelEngine excelEngine = new ExcelEngine()) {