Excel.Application excel = new Excel.Application(); ; Excel.Workbook wbook; Excel.Worksheet wsheet; object mis = Type.Missing; wbook = excel.Workbooks.Add(mis); wsheet = (Excel.Worksheet)wbook.Worksheets.get_Item(1); wsheet.Name = "ตารางสอน"; wsheet.get_Range("A1", "A4").Cells.Font.Size = 9; //เปลี่ยนขนาดตัวอักษรได้ wsheet.get_Range("A9", "A13").Cells.Font.FontStyle = "TH SarabunPSK"; //ไม่สามารถเปลี่ยนFont ได้************************** wsheet = wbook.ActiveSheet; excel.Visible = true; int a = 1; for (int i = 1; i < grdAppointMent.Columns.Count; i++) { if ((i < 20 && i > 3) || i > 37) { continue; } wsheet.Cells[1, a] = grdAppointMent.Columns[i].HeaderText; a++; } for (int r = 0; r < grdAppointMent.Rows.Count; r++) { for (int c = 0; c < grdAppointMent.Columns.Count; c++) { if (c < 3) { wsheet.Cells[r + 2, c + 1] = dt.Rows[r][c + 1]; } if (c > 3 && c < 50) { wsheet.Cells[r + 2, c] = dt.Rows[r][c + 16]; } } } System.Runtime.InteropServices.Marshal.ReleaseComObject(excel); System.Runtime.InteropServices.Marshal.ReleaseComObject(wbook); System.Runtime.InteropServices.Marshal.ReleaseComObject(wsheet); excel = null; wbook = null; wsheet = null;
Workbook workbook = new Workbook(); Worksheet sheet = workbook.Worksheets[0]; sheet.Range["B1"].Text = "Font setting"; sheet.Range["B1"].Style.Font.IsBold = true; sheet.Range["B3"].Text = "Arial"; sheet.Range["B3"].Style.Font.FontName = "Arial"; sheet.Range["B4"].Text = "Large size"; sheet.Range["B4"].Style.Font.Size = 20; sheet.Range["B5"].Text = "Bold"; sheet.Range["B5"].Style.Font.IsBold = true; sheet.Range["B6"].Text = "Italic"; sheet.Range["B6"].Style.Font.IsItalic = true; sheet.Range["B7"].Text = "Superscript"; sheet.Range["B7"].Style.Font.IsSuperscript = true; sheet.Range["B8"].Text = "Colored"; sheet.Range["B8"].Style.Font.Color = Color.FromArgb(255,125,125); sheet.Range["B9"].Text = "Underline"; sheet.Range["B9"].Style.Font.Underline = FontUnderlineType.Single;
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง