//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); var ws = workbook.Worksheets[0]; object[,] data = new object[,]{ {"Name", "City", "Birthday", "Eye color", "Weight"}, {"Richard", "New York", new DateTime(1968, 6, 8), "Blue", 67}, {"Nia", "New York", new DateTime(1972, 7, 3), "Brown", 62}, {"Jared", "New York", new DateTime(1964, 3, 2), "Hazel", 72} }; ws.Range["A1:E4"].Value = data; ws.Range["A:E"].EntireColumn.ColumnWidth *= 1.5; ws.Range["A1:E1"].Interior.Color = System.Drawing.Color.FromArgb(68, 114, 196); ws.Range["A1:E1"].Font.Color = System.Drawing.Color.White; ws.Range["A1:E4"].Borders.Color = System.Drawing.Color.FromArgb(91, 155, 213); ws.Range["A1:E4"].Borders.LineStyle = BorderLineStyle.Thin; //add camera picture ws.Shapes.AddCameraPicture("$A$1:$E$4", 398, 0, 347, 58); // Save to an excel file workbook.Save("AddCameraPicture.xlsx");
' Create a new Workbook Dim workbook As New Workbook Dim ws = workbook.Worksheets(0) Dim data(,) As Object = { {"Name", "City", "Birthday", "Eye color", "Weight"}, {"Richard", "New York", New DateTime(1968, 6, 8), "Blue", 67}, {"Nia", "New York", New DateTime(1972, 7, 3), "Brown", 62}, {"Jared", "New York", New DateTime(1964, 3, 2), "Hazel", 72} } ws.Range("A1:E4").Value = data ws.Range("A:E").EntireColumn.ColumnWidth *= 1.5 ws.Range("A1:E1").Interior.Color = System.Drawing.Color.FromArgb(68, 114, 196) ws.Range("A1:E1").Font.Color = System.Drawing.Color.White ws.Range("A1:E4").Borders.Color = System.Drawing.Color.FromArgb(91, 155, 213) ws.Range("A1:E4").Borders.LineStyle = BorderLineStyle.Thin 'add camera picture Dim cameraPicture As IShape = ws.Shapes.AddCameraPicture("$A$1:$E$4", 398, 0, 347, 58) ' save to an excel file workbook.Save("AddCameraPicture.xlsx")