WinForms윈폼 엑셀 변환 시 라인 색 반영 안됨
페이지 정보
작성자 nanc 작성일 2021-04-23 17:37 조회 3,277회 댓글 0건본문
관련링크
1. SQL 결과를 fpSpread1_Sheet1.DataSource = ds.Tables[0];
2. 제목은
fpSpread1_Sheet1.ColumnHeader.Cells[0, intLoopCount].Value = "NO";
fpSpread1_Sheet1.ColumnHeader.Cells[1, intLoopCount].Value = "이름";
~
3. 헤더에 라인 적용을 위해
fpSpread1.Sheets[0].VisualStyles = FarPoint.Win.VisualStyles.Off;fpSpread1.ActiveSheet.ColumnHeader.DefaultStyle.Renderer =
new FarPoint.Win.Spread.CellType.ColumnHeaderRenderer();
FarPoint.Win.Spread.GridLine blackLine =
new FarPoint.Win.Spread.GridLine(FarPoint.Win.Spread.GridLineType.Flat, Color.Black);
fpSpread1_Sheet1.ColumnHeader.HorizontalGridLine = blackLine;
fpSpread1_Sheet1.ColumnHeader.VerticalGridLine = blackLine;
spSpread 헤더에 라인 색 정상 반영됨
4. 엑셀 Export 저장
saveFileDialog.Filter = "xls File(*.xls)|*.xls";
String fileName = TdateUICreate.gs_dateInfo.YYYYMMTEXT1 + " 급여대장.xls";
saveFileDialog.FileName = fileName;
fpSpread1.Sheets[0].DefaultStyle.Border = new FarPoint.Win.LineBorder(Color.Black);
if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
// 엑셀 변환 후 엑셀 출력 옵션
FarPoint.Win.Spread.PrintInfo printset = new FarPoint.Win.Spread.PrintInfo();
printset.ShowColumnHeader = FarPoint.Win.Spread.PrintHeader.Hide;
printset.ShowRowHeader = FarPoint.Win.Spread.PrintHeader.Hide;
printset.ShowColor = true; // 컬러출력 옵션
fpSpread1.Sheets[0].PrintInfo = printset;
fpSpread1.Sheets[0].Protect = false;
String directoryPath = System.IO.Path.GetDirectoryName(saveFileDialog.FileName);
fpSpread1.SaveExcel(directoryPath + "\\" + fileName, FarPoint.Excel.ExcelSaveFlags.SaveCustomColumnHeaders);
fpSpread1.Sheets[0].Protect = true;
}
5. 저장한 엑셀 파일 열어 보면 1행, 2행이 라인 색 표시가 안됩니다.
답변 부탁드립니다. 감사합니다.
댓글목록
등록된 댓글이 없습니다.