public void Render(ReportProgressUpdate updateFunc, ReportStatusUpdate doneFunc) { ArrayList rows = cacheObj.GetChildArray("ROWS"); int rowCnt = rows.Count; int r = 0; foreach (CTable row in rows) { r++; String rowType = row.GetFieldValue("ROW_TYPE"); ArrayList columns = row.GetChildArray("COLUMNS"); updateFunc(r, rowCnt); foreach (CTable column in columns) { int fromCell = CUtil.StringToInt(column.GetFieldValue("FROM_CELL")); int toCell = CUtil.StringToInt(column.GetFieldValue("TO_CELL")); Boolean isMerged = column.GetFieldValue("IS_MERGED").Equals("True"); Range r1 = xlWorkSheet.Cells[r, fromCell]; Range rowRange = null; if (isMerged) { Range r2 = xlWorkSheet.Cells[r, toCell]; Range newRange = xlWorkSheet.Range[r1, r2]; newRange.Merge(); rowRange = newRange; applyCellStyle(column, newRange); } else { rowRange = r1; applyCellStyle(column, r1); } if (rowType.Contains("HEADER")) { rowRange.Interior.Color = ColorTranslator.ToOle(Color.Orange); } else if (rowType.Contains("FOOTER")) { rowRange.Interior.Color = ColorTranslator.ToOle(Color.Tan); } } } doneFunc(true, false); }
public override FixedDocument CreateFixedDocument() { FixedDocument fd = new FixedDocument(); ReportProgressUpdate updateFunc = GetProgressUpdateFunc(); ReportStatusUpdate doneFunc = GetProgressDoneFunc(); fd.DocumentPaginator.PageSize = PageSize; if (doneFunc != null) { doneFunc(false, false); } if (Parameter.GetFieldValue("COSTING_TYPE").Equals("MOVE")) { Parameter.SetFieldValue("DOCUMENT_TYPE", "3"); } ArrayList arr = OnixWebServiceAPI.GetInventoryTransactionList(Parameter); if (arr == null) { return(fd); } int cnt = arr.Count; UReportPage area = null; createRowTemplates(); int i = 0; Size areaSize = GetAreaSize(); AvailableSpace = areaSize.Height; CReportDataProcessingProperty property = null; #region First Header Case : Row is 0 if (arr.Count == 0) { arr.Add(Parameter); //add for show header and first row empty } #endregion while (i < arr.Count) { CTable o = (CTable)arr[i]; if ((i == 0) || (property.IsNewPageRequired)) { AvailableSpace = areaSize.Height; CurrentPage++; FixedPage fp = new FixedPage(); fp.Margin = Margin; PageContent pageContent = new PageContent(); ((System.Windows.Markup.IAddChild)pageContent).AddChild(fp); fd.Pages.Add(pageContent); area = initNewArea(areaSize); pages.Add(area); fp.Children.Add(area); } property = DataToProcessingProperty(o, arr, i); if (property.IsNewPageRequired) { //Do not create row if that row caused new page flow //But create it in the next page instead i--; } else { ConstructUIRows(area, property); } if (updateFunc != null) { updateFunc(i, cnt); } i++; } if (doneFunc != null) { doneFunc(true, false); } keepFixedDoc = fd; return(fd); }
public override FixedDocument CreateFixedDocument() { FixedDocument fd = new FixedDocument(); ReportProgressUpdate updateFunc = GetProgressUpdateFunc(); ReportStatusUpdate doneFunc = GetProgressDoneFunc(); fd.DocumentPaginator.PageSize = PageSize; if (doneFunc != null) { doneFunc(false, false); } ArrayList arr = OnixWebServiceAPI.GetCashAccountList(Parameter); if (arr == null) { return(fd); } int cnt = arr.Count; UReportPage area = null; createRowTemplates(); int i = 0; Size areaSize = GetAreaSize(); AvailableSpace = areaSize.Height; CReportDataProcessingProperty property = null; while (i < arr.Count) { CTable o = (CTable)arr[i]; if ((i == 0) || (property.IsNewPageRequired)) { AvailableSpace = areaSize.Height; CurrentPage++; FixedPage fp = new FixedPage(); fp.Margin = Margin; PageContent pageContent = new PageContent(); ((System.Windows.Markup.IAddChild)pageContent).AddChild(fp); fd.Pages.Add(pageContent); area = initNewArea(areaSize); pages.Add(area); fp.Children.Add(area); } property = DataToProcessingProperty(o, arr, i); if (property.IsNewPageRequired) { //Do not create row if that row caused new page flow //But create it in the next page instead i--; } else { ConstructUIRows(area, property); } if (updateFunc != null) { updateFunc(i, cnt); } i++; } if (doneFunc != null) { doneFunc(true, false); } keepFixedDoc = fd; return(fd); }
public void SetProgressUpdateFunc(ReportProgressUpdate func) { updateProgFunc = func; }
public virtual FixedDocument CreateReportFixedDocument() { excel = new CExcelRenderer(rptCfg.ReportName); FixedDocument fd = new FixedDocument(); ReportProgressUpdate updateFunc = GetProgressUpdateFunc(); ReportStatusUpdate doneFunc = GetProgressDoneFunc(); fd.DocumentPaginator.PageSize = PageSize; if (doneFunc != null) { doneFunc(false, false); } ArrayList arr = getRecordSet(); if (arr == null) { return(fd); } int cnt = arr.Count; UReportPage area = null; createRowTemplates(); excel.CalculateMergeCellRange(baseTemplateName); int i = 0; int r = 0; Size areaSize = GetAreaSize(); AvailableSpace = areaSize.Height; CReportDataProcessingProperty property = null; while (i < arr.Count) { CTable o = (CTable)arr[i]; if ((r == 0) || (property.IsNewPageRequired)) { AvailableSpace = areaSize.Height; CurrentPage++; FixedPage fp = new FixedPage(); fp.Margin = Margin; PageContent pageContent = new PageContent(); ((System.Windows.Markup.IAddChild)pageContent).AddChild(fp); area = initNewArea(areaSize); fp.Children.Add(area); if (isInRange(CurrentPage)) { fd.Pages.Add(pageContent); pages.Add(area); } } property = DataToProcessingProperty(o, arr, i); if (property.IsNewPageRequired) { //Do not create row if that row caused new page flow //But create it in the next page instead i--; r--; } else { ConstructUIRows(area, property); } if (updateFunc != null) { updateFunc(i, cnt); } i++; r++; } if (doneFunc != null) { doneFunc(true, false); } keepFixedDoc = fd; return(fd); }
public override FixedDocument CreateFixedDocument() { FixedDocument fd = new FixedDocument(); ReportProgressUpdate updateFunc = GetProgressUpdateFunc(); ReportStatusUpdate doneFunc = GetProgressDoneFunc(); fd.DocumentPaginator.PageSize = PageSize; if (doneFunc != null) { doneFunc(false, false); } ArrayList arr = OnixWebServiceAPI.GetInventoryBalanceSummaryList(Parameter); //string orderArr = string.Empty; //foreach (CTable o in arr) //{ // orderArr += o.GetFieldValue("ITEM_NAME_THAI"); // orderArr += "," + o.GetFieldValue("ITEM_ID"); // orderArr += "," + o.GetFieldValue("DESCRIPTION"); // orderArr += "," + o.GetFieldValue("LOCATION_ID"); // orderArr += "," + o.GetFieldValue("BALANCE_DATE"); // orderArr += "\n"; //} //MessageBox.Show(orderArr); if (arr == null) { return(fd); } int cnt = arr.Count; UReportPage area = null; createRowTemplates(); int i = 0; Size areaSize = GetAreaSize(); AvailableSpace = areaSize.Height; CReportDataProcessingProperty property = null; while (i < arr.Count) { CTable o = (CTable)arr[i]; if ((i == 0) || (property.IsNewPageRequired)) { AvailableSpace = areaSize.Height; CurrentPage++; FixedPage fp = new FixedPage(); fp.Margin = Margin; PageContent pageContent = new PageContent(); ((System.Windows.Markup.IAddChild)pageContent).AddChild(fp); fd.Pages.Add(pageContent); area = initNewArea(areaSize); pages.Add(area); fp.Children.Add(area); } property = DataToProcessingProperty(o, arr, i); if (property.IsNewPageRequired) { //Do not create row if that row caused new page flow //But create it in the next page instead i--; if (property.TempNotRowDetails > 0) { ConstructUIRows(area, property); } } else { ConstructUIRows(area, property); } if (updateFunc != null) { updateFunc(i, cnt); } i++; } if (doneFunc != null) { doneFunc(true, false); } keepFixedDoc = fd; return(fd); }