2025年8月5日 星期二

V20305D_批次匯入- Log_檔案-[匯出結果說明]欄位-垂直上靠, 水平左靠 - SPIRE.XLS

 目的: V20305D_批次匯入- Log_檔案-[匯出結果說明]欄位-垂直上靠, 水平左靠  - SPIRE.XLS

處理說明: 1>cell.Style.VerticalAlignment   &  cell1.Style.HorizontalAlignment
                       CellRange cell1 = ws.Columns[44];
                       cell1.Style.VerticalAlignment = VerticalAlignType.Top;
                       cell1.Style.HorizontalAlignment = HorizontalAlignType.Left;
                   2> cell.Style.WrapText  &  cell1.RowHeight 
                        cell1.Style.WrapText = true;
                        cell1.RowHeight = 50;


1>*.cs
ws.Range[myfunc.GetExcelPos(44, 1)].Value = "匯入結果說明";
ws.AutoFitRow(1);
//設定[匯出結果說明]欄.垂直上靠, 水平左靠
CellRange cell1 = ws.Columns[44];
cell1.Style.VerticalAlignment = VerticalAlignType.Top;
cell1.Style.HorizontalAlignment = HorizontalAlignType.Left;

cell1.Style.WrapText = true;
cell1.RowHeight = 50;


PS:

垂直上靠: 使用 cell.Style.VerticalAlignment = VerticalAlignType.Top;

VerticalAlignType 是一個列舉,常用的值包括 Top(上靠)、Center(置中)和 Bottom(下靠)。

水平左靠: 使用 cell.Style.HorizontalAlignment = HorizontalAlignType.Left;

HorizontalAlignType 是一個列舉,常用的值包括 Left(左靠)、Center(置中)和 Right(右靠)。

沒有留言:

張貼留言