Using package = New ExcelPackage() Dim workbook = package.Workbook '*** Sheet 1 Dim worksheet = workbook.Worksheets.Add("Sheet1") worksheet.Cells("A1").Value = "ThaiCreate.Com" worksheet.Cells("A1").Style.Font.Bold = True worksheet.Cells("A1").Style.Font.Color.SetColor(System.Drawing.Color.Red) worksheet.Cells("B3").Value = "2017" worksheet.Cells("B3").Style.Font.Size = 20 worksheet.Column(5).Width = 50 worksheet.Cells("E5").Value = "New Member" worksheet.Cells("E5").Style.Font.Size = 12 worksheet.Cells("E5").Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Right Using range As ExcelRange = worksheet.Cells("A8:E9") range.Merge = True range.Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Medium, System.Drawing.Color.Black) range.Value = "Sawatdee ThaiCreate.Com" range.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center range.Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center range.Style.Border.Top.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin range.Style.Border.Left.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin range.Style.Border.Right.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin range.Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin End Using package.SaveAs(New FileInfo(Server.MapPath("Xls/myExcel.xlsx"))) End Using
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท