Exemplo n.º 1
0
 public void VerticalAlignmentCells(string startCell, string endCell, Excel.Constants alignment)
 {
     //垂直对齐一行单元格
     xlsRg = xlsWs.get_Range(startCell, endCell);
     xlsRg.VerticalAlignment = alignment;
 }
Exemplo n.º 2
0
 public void SetOneCellHorizontalAlignment(int CellRowID, int CellColumnID, Excel.Constants alignment)
 {
     xlsRg = (Excel.Range)xlsWs.Cells[CellRowID, CellColumnID];
     xlsRg.HorizontalAlignment = alignment;
 }
Exemplo n.º 3
0
 public void HorizontalAlignmentCells(string startCell, string endCell, Excel.Constants alignment)
 {
     //水平对齐一行单元格
     xlsRg = xlsWs.get_Range(startCell, endCell);
     xlsRg.HorizontalAlignment = alignment;
 }
Exemplo n.º 4
0
        public void SetCellProperty(string wsn, int Startx, int Starty, int Endx, int Endy, int size, string name, Excel.Constants color, Excel.Constants HorizontalAlignment)
        {
            //name = "宋体";
            //size = 12;
            //color = Excel.Constants.xlAutomatic;
            //HorizontalAlignment = Excel.Constants.xlRight;

            Excel.Worksheet ws = GetSheet(wsn);
            ws.get_Range(ws.Cells[Startx, Starty], ws.Cells[Endx, Endy]).Font.Name  = name;
            ws.get_Range(ws.Cells[Startx, Starty], ws.Cells[Endx, Endy]).Font.Size  = size;
            ws.get_Range(ws.Cells[Startx, Starty], ws.Cells[Endx, Endy]).Font.Color = color;

            ws.get_Range(ws.Cells[Startx, Starty], ws.Cells[Endx, Endy]).HorizontalAlignment = HorizontalAlignment;
        }