(在线)delphi怎么控制Excel的单元格文字自动换行

解决方案 »

  1.   

    with ExcelWorksheet1.Range[ExcelWorksheet1.Cells.Item[1, 1], ExcelWorksheet1.Cells.Item[1, 37]] do
     begin
        //ColumnWidth := 8; // 列宽
        MergeCells := True; //合并
        WrapText := True; //自动换行
        HorizontalAlignment := xlCenter; //对齐方式 xlleft,xlright
        VerticalAlignment := xlCenter; //对齐方式 xltop,xlbottom
        font.Bold:=true; //字体加重
        //font.Italic := True ; //斜体
        //font.Colorindex:=6; //颜色
        font.Name:='楷体_GB2312'; //字体
        font.FontStyle := '常规' ;
         font.Size:= 20; //字号
     end;