Esempio n. 1
0
        public object[,] ParseReportsToTitleArray(Report[] pReports)
        {
            if (pReports == null)
            {
                throw new ArgumentNullException("pReports");
            }

            const int nbColumn = ColPrompt - 1;
            var       nbPrompt = GetMaxPromptsLength(pReports);

            var titles = ExcelArray <object> .Create(1, nbColumn + nbPrompt);

            //set titles
            titles[1, ColLog]       = ColLogName;
            titles[1, ColInsCuid]   = ColInsCuidName;
            titles[1, ColInsId]     = ColInsIdName;
            titles[1, ColInsStatus] = ColInsStatusName;
            titles[1, ColInsDate]   = ColInsDateName;
            titles[1, ColInsTime]   = ColInsTimeName;
            titles[1, ColDocPath]   = ColDocPathName;
            titles[1, ColDocCuid]   = ColDocCuidName;
            titles[1, ColDocId]     = ColDocIdName;
            titles[1, ColDocType]   = ColDocTypeName;
            titles[1, ColDocName]   = ColDocNameName;
            titles[1, ColNbInst]    = ColNbInstName;
            titles[1, ColNbPrompt]  = ColNbPromptName;

            for (int p = 1, c = ColPrompt; p <= nbPrompt; p++, c++)
            {
                titles[1, c] = ColPromptName + p.ToString();
            }
            return(titles);
        }
Esempio n. 2
0
        public object[,] ParseReportsToDataArray(Report[] pReports)
        {
            if (pReports == null)
            {
                return(null);
            }

            var nbReport = pReports.Length;
            var nbColumn = ColPrompt - 1;
            var nbPrompt = GetMaxPromptsLength(pReports);

            var data = ExcelArray <object> .Create(nbReport, nbColumn + nbPrompt);

            //set data
            for (int ir = 0, r = 1; ir < nbReport; ir++, r++)
            {
                var report = pReports[ir];
                data[r, ColLog] = report.LOG;
                if (report.Instance != null)
                {
                    data[r, ColInsCuid]   = report.Instance.Cuid;
                    data[r, ColInsId]     = report.Instance.Id;
                    data[r, ColInsStatus] = report.Instance.Status;
                    data[r, ColInsDate]   = report.Instance.Date;
                    data[r, ColInsTime]   = report.Instance.Time;
                }
                data[r, ColDocPath] = report.Folder;
                data[r, ColDocCuid] = report.Cuid;
                data[r, ColDocId]   = report.Id;
                data[r, ColDocType] = report.Type;
                data[r, ColDocName] = report.Name;
                data[r, ColNbInst]  = report.NbChild;
                if (report.Prompts != null)
                {
                    if (report.Prompts.Length != 0)
                    {
                        data[r, ColNbPrompt] = report.Prompts.Length;
                    }
                    for (int p = 0, col = ColPrompt; p < report.Prompts.Length; p++, col++)
                    {
                        data[r, col] = Truncate(report.Prompts[p].Value, 910);
                    }
                }
            }
            return(data);
        }