protected override void RenderTitle() { DataTable dataSource = DataSource.Tables["TitleDataTable"]; if (dataSource != null) { /* NOTE: do coding here. */ rowIndex += 2; columnIndex = documentStat.StartColumnIndex + 2; document.SetRowHeight(rowIndex, 120); document.SetCellValue(rowIndex, columnIndex, dataSource.Rows[0][0].ToString()); Int32 endColumnIndex = columnIndex + dataSource.Columns.Count; SLStyle style = document.CreateStyle(); style.Font = new SLFont { FontName = "Arial", Bold = true, FontSize = 20, FontColor = System.Drawing.Color.Black }; style.SetWrapText(false); document.AutoFitRow(rowIndex); style.RemoveFill(); style.RemoveBorder(); document.SetCellStyle(rowIndex, columnIndex, style); document.MergeWorksheetCells(rowIndex, columnIndex, rowIndex, endColumnIndex); rowIndex++; } }
protected override void RenderBody() { DataTable dataSource = DataSource.Tables["DataTable"]; DataTable dataGroupSource = DataSource.Tables["GroupDataTable"]; if (dataSource != null) { if (dataGroupSource != null) /* NOTE: do coding here. */ } { /* NOTE: do coding here. */ rowIndex += 2; columnIndex = documentStat.StartColumnIndex + 2; Int32 leftValueColIndex = columnIndex + 4, rightColIndex = leftValueColIndex + 4, rightValueColIndex = rightColIndex + 4; SLStyle defaultStyle = document.CreateStyle(); defaultStyle.Font = new SLFont { FontName = "Arial" } ; defaultStyle.RemoveFill(); defaultStyle.RemoveBorder(); document.SetCellStyle(rowIndex, columnIndex, defaultStyle); document.SetCellValue(rowIndex, columnIndex, MapColumnIntoHeader("Period")); document.SetCellValue(rowIndex, leftValueColIndex, dataSource.Rows[0]["Period"].ToString()); rowIndex++; document.SetCellStyle(rowIndex, columnIndex, defaultStyle); document.SetCellValue(rowIndex, columnIndex, MapColumnIntoHeader("EmpCode")); document.SetCellValue(rowIndex, leftValueColIndex, dataSource.Rows[0]["EmpCode"].ToString()); rowIndex++; document.SetCellStyle(rowIndex, columnIndex, defaultStyle); document.SetCellValue(rowIndex, columnIndex, MapColumnIntoHeader("JobPos")); document.SetCellValue(rowIndex, leftValueColIndex, dataSource.Rows[0]["JobPos"].ToString()); rowIndex++; document.SetCellStyle(rowIndex, columnIndex, defaultStyle); document.SetCellValue(rowIndex, columnIndex, MapColumnIntoHeader("Dept")); document.SetCellValue(rowIndex, leftValueColIndex, dataSource.Rows[0]["Dept"].ToString()); rowIndex++; document.SetCellStyle(rowIndex, columnIndex, defaultStyle); document.SetCellValue(rowIndex, columnIndex, MapColumnIntoHeader("Currency")); document.SetCellValue(rowIndex, leftValueColIndex, dataSource.Rows[0]["Currency"].ToString()); rowIndex++; document.SetCellStyle(rowIndex, columnIndex, defaultStyle); document.SetCellValue(rowIndex, columnIndex, MapColumnIntoHeader("BasicSalary")); document.SetCellValue(rowIndex, leftValueColIndex, dataSource.Rows[0]["BasicSalary"].ToString()); rowIndex++; document.SetCellStyle(rowIndex, columnIndex, defaultStyle); document.SetCellValue(rowIndex, columnIndex, MapColumnIntoHeader("TaxAllow")); document.SetCellValue(rowIndex, leftValueColIndex, dataSource.Rows[0]["TaxAllow"].ToString()); rowIndex++; document.SetCellStyle(rowIndex, columnIndex, defaultStyle); document.SetCellValue(rowIndex, columnIndex, MapColumnIntoHeader("Tax")); document.SetCellValue(rowIndex, leftValueColIndex, dataSource.Rows[0]["Tax"].ToString()); rowIndex++; document.SetCellStyle(rowIndex, columnIndex, defaultStyle); document.SetCellValue(rowIndex, columnIndex, MapColumnIntoHeader("Allow")); document.SetCellValue(rowIndex, leftValueColIndex, dataSource.Rows[0]["Allow"].ToString()); rowIndex++; document.SetCellStyle(rowIndex, columnIndex, defaultStyle); document.SetCellValue(rowIndex, columnIndex, MapColumnIntoHeader("Deduction")); document.SetCellValue(rowIndex, leftValueColIndex, dataSource.Rows[0]["Deduction"].ToString()); rowIndex++; document.SetCellStyle(rowIndex, columnIndex, defaultStyle); document.SetCellValue(rowIndex, columnIndex, MapColumnIntoHeader("HpAllow")); document.SetCellValue(rowIndex, leftValueColIndex, dataSource.Rows[0]["HpAllow"].ToString()); rowIndex++; document.SetCellStyle(rowIndex, columnIndex, defaultStyle); document.SetCellValue(rowIndex, columnIndex, MapColumnIntoHeader("GrossAllow")); document.SetCellValue(rowIndex, leftValueColIndex, dataSource.Rows[0]["GrossAllow"].ToString()); rowIndex++; document.SetCellStyle(rowIndex, columnIndex, defaultStyle); document.SetCellValue(rowIndex, columnIndex, MapColumnIntoHeader("HIns")); document.SetCellValue(rowIndex, leftValueColIndex, dataSource.Rows[0]["HIns"].ToString()); rowIndex++; document.SetCellStyle(rowIndex, columnIndex, defaultStyle); document.SetCellValue(rowIndex, columnIndex, MapColumnIntoHeader("RIns")); document.SetCellValue(rowIndex, leftValueColIndex, dataSource.Rows[0]["RIns"].ToString()); rowIndex++; document.SetCellStyle(rowIndex, columnIndex, defaultStyle); document.SetCellValue(rowIndex, columnIndex, MapColumnIntoHeader("TotalDeduct")); document.SetCellValue(rowIndex, leftValueColIndex, dataSource.Rows[0]["TotalDeduct"].ToString()); rowIndex++; document.SetCellStyle(rowIndex, columnIndex, defaultStyle); document.SetCellValue(rowIndex, columnIndex, MapColumnIntoHeader("THP")); document.SetCellValue(rowIndex, leftValueColIndex, dataSource.Rows[0]["THP"].ToString()); rowIndex++; document.SetCellStyle(rowIndex, columnIndex, defaultStyle); document.SetCellValue(rowIndex, columnIndex, MapColumnIntoHeader("InWords")); document.SetCellValue(rowIndex, leftValueColIndex, dataSource.Rows[0]["InWords"].ToString()); rowIndex++; } }