diff --git a/Pictures in Excel/Place In Cell Picture/.NET/Place In Cell Picture/Place In Cell Picture.slnx b/Pictures in Excel/Place In Cell Picture/.NET/Place In Cell Picture/Place In Cell Picture.slnx new file mode 100644 index 00000000..105e32bd --- /dev/null +++ b/Pictures in Excel/Place In Cell Picture/.NET/Place In Cell Picture/Place In Cell Picture.slnx @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Pictures in Excel/Place In Cell Picture/.NET/Place In Cell Picture/Place In Cell Picture/Data/Image.png b/Pictures in Excel/Place In Cell Picture/.NET/Place In Cell Picture/Place In Cell Picture/Data/Image.png new file mode 100644 index 00000000..ee94f5a1 Binary files /dev/null and b/Pictures in Excel/Place In Cell Picture/.NET/Place In Cell Picture/Place In Cell Picture/Data/Image.png differ diff --git a/Pictures in Excel/Place In Cell Picture/.NET/Place In Cell Picture/Place In Cell Picture/Output/.gitkeep b/Pictures in Excel/Place In Cell Picture/.NET/Place In Cell Picture/Place In Cell Picture/Output/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Pictures in Excel/Place In Cell Picture/.NET/Place In Cell Picture/Place In Cell Picture/Place In Cell Picture.csproj b/Pictures in Excel/Place In Cell Picture/.NET/Place In Cell Picture/Place In Cell Picture/Place In Cell Picture.csproj new file mode 100644 index 00000000..f218a9b4 --- /dev/null +++ b/Pictures in Excel/Place In Cell Picture/.NET/Place In Cell Picture/Place In Cell Picture/Place In Cell Picture.csproj @@ -0,0 +1,24 @@ + + + + Exe + net10.0 + Place_In_Cell_Picture + enable + enable + + + + + + + + + Always + + + Always + + + + diff --git a/Pictures in Excel/Place In Cell Picture/.NET/Place In Cell Picture/Place In Cell Picture/Program.cs b/Pictures in Excel/Place In Cell Picture/.NET/Place In Cell Picture/Place In Cell Picture/Program.cs new file mode 100644 index 00000000..b75731a4 --- /dev/null +++ b/Pictures in Excel/Place In Cell Picture/.NET/Place In Cell Picture/Place In Cell Picture/Program.cs @@ -0,0 +1,38 @@ +using System.IO; +using Syncfusion.XlsIO; + +namespace Place_In_Cell_Picture +{ + class Program + { + static void Main(string[] args) + { + 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 place in cell picture + FileStream imageStream = new FileStream(Path.GetFullPath(@"Data/Image.png"), FileMode.Open, FileAccess.Read); + IPictureShape picture = worksheet.Pictures.AddPicture(1, 1, imageStream); + + picture.PlaceInCell = true; + + #region Save + //Saving the workbook + workbook.SaveAs(Path.GetFullPath("Output/PlaceInCellPicture.xlsx")); + #endregion + + //Dispose streams + imageStream.Dispose(); + } + } + } +} + + + + +