2 range.Cells.Font.Name = "Tahoma";
3 range2.Cells.Font.Name = "Times New Roman";
4 // Diapazon uchun shrift o’lchami
5 range.Cells.Font.Size = 10;
6 //Eskiz
7 Range.Font.Bold = true;
8 //Matin rangi
9 range.Font.Color = ColorTranslator.ToOle(Color.Blue);
Hujayralarni bittaga birlashtirish
C#
1 // F2 katakchalarini K2 ga birlashtiring
2. Excel.Range range3 = sheet.get_Range("F2", "K2");
3. range3.Merge(Type.Missing);
Hujayralarni kenglik va balandlikda o'zgartirish
C#
1 //bir qator hujjatlar kengligini oshirish
2 Excel.Range range2 = sheet.get_Range("D1", "S1");
3 range2.EntireColumn.ColumnWidth = 10;
4 // bir qator hujjatlar balandligi hajmini oshirish
5 Excel.Range rowHeight = sheet.get_Range("A4", "S4");
6 rowHeight.EntireRow.RowHeight =
50;range.EntireColumn.AutoFit();range.EntireColumn.AutoFit(); //авторазмер
Hujayralar diapazonini urish
C#
1 Excel.Range r1 = sheet.Cells[countRow, 2];
2 Excel.Range r2 = sheet.Cells[countRow, 19];
3 Excel.Range rangeColor = sheet.get_Range(r1, r2);
4 rangeColor.Borders.Color = ColorTranslator.ToOle(Color.Black);
Biz bir qator hujayralar tarkibini tekislaymiz.
C#
1 Excel.Range r = sheet.get_Range("A1", "S40");
2 //bezaklar
3 r.Font.Name = "Calibri";
4 r.Cells.Font.Size = 10;
5 r.VerticalAlignment = Excel.XlVAlign.xlVAlignCenter;
6 r.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter;
Formulalarni hisoblash misollari, barcha joylashtirish formulalari o'zgarishsiz Excelning o'zidan ko'chirildi. Yacheykaning o'rni hisoblagich o'zgaruvchisidan olinadi va katakning harfi o'rniga qo'yiladi
Do'stlaringiz bilan baham: |