ex ) ---> 스프레드 Sheet 1, 2,3 데이타 각각 가져와서 Excel에 뿌려주기
FarPoint.Win.Spread.SheetView sv = new FarPoint.Win.Spread.SheetView();
FarPoint.Win.Spread.SheetView sv01 = new FarPoint.Win.Spread.SheetView();
FarPoint.Win.Spread.SheetView sv02 = new FarPoint.Win.Spread.SheetView();
--> 스프레드 데이타 복사
sv = CopySheet(this.spdNICUFollowDetailList.ActiveSheet);
sv01 = CopySheet(this.spdNICUDetail01.ActiveSheet);
sv02 = CopySheet(this.spdNICUDetail02.ActiveSheet);
SaveFileDialog saveExcelFileDialog = new SaveFileDialog();
saveExcelFileDialog.InitialDirectory = "C:\\";
saveExcelFileDialog.Filter = "Excel files (*.xls)|*.xls";
saveExcelFileDialog.FilterIndex = 0;
saveExcelFileDialog.FileName = "NICU_" + this.txtUnitNo.Text; //+ "_" + this.txtPatNm.Text;
if (saveExcelFileDialog.ShowDialog() == DialogResult.OK)
{
this.fpspreadExc.Sheets[0].Protect = false;
this.fpspreadExc.Sheets[1].Protect = false;
this.fpspreadExc.Sheets[2].Protect = false;
// 하나의 스프레드를 만들어서 Sheet 별로 담기
fpspreadExc.Sheets[0] = sv;
fpspreadExc.Sheets[1] = sv01;
fpspreadExc.Sheets[2] = sv02;
this.fpspreadExc.Visible = true;
// 담은 값을 엑셀에 뿌려주기
this.fpspreadExc.SaveExcel(saveExcelFileDialog.FileName, FarPoint.Win.Spread.Model.IncludeHeaders.ColumnHeadersCustomOnly);
this.fpspreadExc.Visible = false;
this.fpspreadExc.Sheets[0].Protect = true;
this.fpspreadExc.Sheets[1].Protect = true;
this.fpspreadExc.Sheets[2].Protect = true;
MessageBoxViewer.ShowAlert("HIS.SP", "SET_SAVE_SUCCEEDED");
}
--> 스프레드 Copy 사용자메서드
public FarPoint.Win.Spread.SheetView CopySheet(FarPoint.Win.Spread.SheetView sheet)
{
FarPoint.Win.Spread.SheetView newSheet = null;
if (sheet != null)
{
newSheet = (FarPoint.Win.Spread.SheetView)FarPoint.Win.Serializer.LoadObjectXml(sheet.GetType(), FarPoint.Win.Serializer.GetObjectXml(sheet, "CopySheet"), "CopySheet");
}
return newSheet;
}
댓글 없음:
댓글 쓰기