0
나는 행에 테두리를 추가하려면 다음 코드를 가지고 :상단 행에 테두리가 적용되지 않는 이유는 무엇입니까 (Aspose 셀)?
Range _range;
_range = customerWorksheet.Cells.CreateRange("A1", "P1");
_range.SetOutlineBorders(CellBorderType.Hair, Color.Black);
를 ... 그러나 그것은 작동하지 않습니다 - 국경이 (행 "1")이 맨 윗줄에 표시되지 않습니다 :
왜 이런 테두리를 추가 할 수 있습니까? 나머지 테두리는 어떻게 처리합니까? 그것은 작동한다
Cell PAItemCell = customerWorksheet.Cells[rowToPopulate, PAITEMCODE_COL];
PAItemCell.PutValue(frbdbc.PAItemCode, true);
var paiStyle = PAItemCell.GetStyle();
paiStyle.Font.Name = fontForSheets;
paiStyle.IsTextWrapped = false;
PAItemCell.SetStyle(paiStyle);
및 여기 테두리 이론적 시트 (데이터 부분에 추가하는 방법은 : 여기
은 하나의 셀을 추가하는 방법을 도시하는 상부 행의 코드 단편이야 상단 행도 필요하지 않습니다.) :private void BorderizeDataPortionOfCustomerSheet()
{
int rowsUsed = customerWorksheet.Cells.Rows.Count;
int colsUsed = SHIPVARIANCE_COL;
string bottomRightRange = string.Format("P{0}", rowsUsed);
var range = customerWorksheet.Cells.CreateRange("A1", bottomRightRange);
//Setting border for each cell in the range
var style = workBook.CreateStyle();
style.SetBorder(BorderType.BottomBorder, CellBorderType.Thin, Color.Black);
style.SetBorder(BorderType.LeftBorder, CellBorderType.Thin, Color.Black);
style.SetBorder(BorderType.RightBorder, CellBorderType.Thin, Color.Black);
style.SetBorder(BorderType.TopBorder, CellBorderType.Thin, Color.Black);
for (int r = range.FirstRow; r < range.RowCount; r++)
{
for (int c = range.FirstColumn; c < range.ColumnCount; c++)
{
Cell cell = customerWorksheet.Cells[r, c];
cell.SetStyle(style, new StyleFlag()
{
TopBorder = true,
BottomBorder = true,
LeftBorder = true,
RightBorder = true
});
}
}
//Setting outline border to range
range.SetOutlineBorder(BorderType.TopBorder, CellBorderType.Thin, Color.Black);
range.SetOutlineBorder(BorderType.BottomBorder, CellBorderType.Thin, Color.Black);
range.SetOutlineBorder(BorderType.LeftBorder, CellBorderType.Thin, Color.Black);
range.SetOutlineBorder(BorderType.RightBorder, CellBorderType.Thin, Color.Black);
customerWorksheet.FreezePanes(FIRST_DATA_ROW, SHORTNAME_COL, rowsUsed, colsUsed);
}
첫 번째 코드가 작동하지 않기 때문에 "다시"코드를 추가했습니다. 굵은 글씨 없음, 왼쪽 맞춤 없음, 배경색 없음. 그러나 모든 것들이 지금 일하고 있습니다. 국경은 아니지만 .. 왜 안돼? 첫 번째 시도가 작동하지 않았기 때문에 첫 번째 행을 다시 포맷 할 때까지 이전 시트 경계선이 전체 시트에 대해 수행되었습니다. –