From 12e5c4ac76e709c04f7c34de643e0b02b9d90c75 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 27 Jan 2015 20:59:34 +0000 Subject: [PATCH] Logic to read the meta file and generate the Complete RO Report Logic to generate a Complete RO Report --- PROMS/Volian.Print.Library/CompleteRORpt.cs | 1303 +++++++------------ PROMS/Volian.Print.Library/PDFReport.cs | 231 +--- 2 files changed, 489 insertions(+), 1045 deletions(-) diff --git a/PROMS/Volian.Print.Library/CompleteRORpt.cs b/PROMS/Volian.Print.Library/CompleteRORpt.cs index 49cfc394..1e2399ca 100644 --- a/PROMS/Volian.Print.Library/CompleteRORpt.cs +++ b/PROMS/Volian.Print.Library/CompleteRORpt.cs @@ -1,17 +1,13 @@ using System; using System.Collections.Generic; using System.Text; +using System.Text.RegularExpressions; using System.IO; using iTextSharp.text.pdf; using iTextSharp.text; -/*** - * Complete RO Report TO DO: - * - We are reading in the formation from the PRINT.TMP file. - * - Need to organize and put information on the page (continue message, page breaks, margings, etc.) - * - Need to process X/Y Plot language - * - Need to process tables (or leave table text as is) - * - Need to process graphic files - ***/ +using VEPROMS.CSLA.Library; +using Volian.Base.Library; + namespace Volian.Print.Library { @@ -21,19 +17,240 @@ namespace Volian.Print.Library RODataFile RO_df = null; int curheaderlen; string RODataFileName; - iTextSharp.text.Document pdfReportDoc; - public CompleteROReport(iTextSharp.text.Document document, string dataFileName) + iTextSharp.text.Document pdfReportDoc = null; + PdfPTable datatable = null; + + private iTextSharp.text.Font _f14; // = pdf.GetFont("Arial Unicode MS", 14, 1, Color.BLACK); + + public iTextSharp.text.Font F14 { - Hdrs = new Headers(); - RODataFileName = dataFileName; - pdfReportDoc = document; + get { return _f14; } + set { _f14 = value; } + } + private iTextSharp.text.Font _f10; + + public iTextSharp.text.Font F10 + { + get { return _f10; } + set { _f10 = value; } + } + private iTextSharp.text.Font _f12; + + public iTextSharp.text.Font F12 + { + get { return _f12; } + set { _f12 = value; } + } + private iTextSharp.text.Font _f10Bold; + + public iTextSharp.text.Font F10Bold + { + get { return _f10Bold; } + set { _f10Bold = value; } + } + private iTextSharp.text.Font _f12Bold; + + public iTextSharp.text.Font F12Bold + { + get { return _f12Bold; } + set { _f12Bold = value; } } + private bool _ConvertCaretToDelta = true; + + public bool ConvertCaretToDelta + { + get { return _ConvertCaretToDelta; } + set { _ConvertCaretToDelta = value; } + } + private bool _IncludeEmptyROFields = false; + + public bool IncludeEmptyROFields + { + get { return _IncludeEmptyROFields; } + set { _IncludeEmptyROFields = value; } + } + private int _ROFstID; + + public int ROFstID + { + get { return _ROFstID; } + set { _ROFstID = value; } + } + private string ReportTitle = "Complete Referenced Objects Report"; + private PdfWriter _MyPDFWriter; + + public CompleteROReport(PdfWriter mypdfwriter, iTextSharp.text.Document document, string dataFileName, bool convertCaretToDelta, bool includeEmptyROFields) + { + Hdrs = new Headers(); + pdfReportDoc = document; + RODataFileName = dataFileName; + _ConvertCaretToDelta = convertCaretToDelta; + _MyPDFWriter = mypdfwriter; + _IncludeEmptyROFields = includeEmptyROFields; + } + public void StartNewDataTable() + { + datatable = new PdfPTable(1); + datatable.TotalWidth = pdfReportDoc.PageSize.Width - pdfReportDoc.LeftMargin - pdfReportDoc.RightMargin; + datatable.LockedWidth = true; + PdfPCell cell = new PdfPCell(new Phrase(ReportTitle, F14)); + cell.HorizontalAlignment = Element.ALIGN_CENTER; + cell.BackgroundColor = Color.WHITE; + cell.BorderColor = Color.WHITE; + datatable.AddCell(cell); + datatable.HeaderRows = 3; + datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT; + } public void Run() { + StartNewDataTable(); RO_df = new RODataFile(RODataFileName); - Console.WriteLine("Complete RO Report"); PrintReport(); + RO_df.close(); + } + private Dictionary _MyDocOutline = new Dictionary(); + + internal Dictionary MyDocOutline + { + get { return _MyDocOutline; } + set { _MyDocOutline = value; } + } + public class DocOutline + { + private PdfOutline _MyOutline; + + public PdfOutline MyOutline + { + get { return _MyOutline; } + set { _MyOutline = value; } + } + private string _MyHeader; + + public string MyHeader + { + get { return _MyHeader; } + set { _MyHeader = value; } + } + public DocOutline(PdfOutline outline, string header) + { + _MyHeader = header; + _MyOutline = outline; + } + } + private string ReplaceLineDrawCharsWithUnicode(string text) + { + text = text.Replace("\xc4", "\x2500"); // Horizontal + text = text.Replace("\xb3", "\x2502"); // Vertical + text = text.Replace("\xc0", "\x2514"); // Bottom Left Corner + text = text.Replace("\xd9", "\x2518"); // Bottom Right Corner + text = text.Replace("\xc1", "\x2534"); // Bottom Tee + text = text.Replace("\xda", "\x250c"); // Upper Left Corner + text = text.Replace("\xc3", "\x251c"); // Left Tee + text = text.Replace("\xbf", "\x2510"); // Upper Right Corner + text = text.Replace("\xc2", "\x252c"); // Top Tee + text = text.Replace("\xb4", "\x2524"); // Right Tee + text = text.Replace("\xc5", "\x253c"); // Plus + return text; + } + public Phrase ConvertDOSSuperAndSubScripts(string instr, Font fnt) + { + int idx = 0; + Chunk chk; + Phrase p = new Phrase(); + instr = instr.Replace("`", "\u00B0"); //degree + if (ConvertCaretToDelta) + instr = instr.Replace("^", "\u0394"); // delta + instr = ReplaceLineDrawCharsWithUnicode(instr); + // Handle super/sub scripts + MatchCollection mc = Regex.Matches(instr, "[#~](.*?)[#~]"); + foreach (Match m in mc) + { + if (idx < m.Index) + { + int strlen = m.Index - idx; + chk = new Chunk(instr.Substring(idx, strlen), fnt); + chk.SetTextRise(0); + p.Add(chk); + } + switch (m.Value[0]) + { + case '#': + chk = new Chunk(m.Value.Substring(1, m.Length-2), fnt); + chk.SetTextRise(.25F * chk.Font.Size); + p.Add(chk); + idx = m.Index + m.Length; + break; + case '~': + chk = new Chunk(m.Value.Substring(1, m.Length-2), fnt); + chk.SetTextRise(-.25F * chk.Font.Size); + p.Add(chk); + idx = m.Index + m.Length; + break; + } + } + if (idx < instr.Length - 1) + { + chk = new Chunk(instr.Substring(idx), fnt); + chk.SetTextRise(0); + p.Add(chk); + } + + return p; + } + + public void AddText(string txt, Font fnt) + { + // break the text up on double returns (paragraphs) and put each in their own cell + // this will allow for page breaks between paragraphs0 + string[] delim = { "\r\n\r\n","\r\n \r\n" }; + string[] strlst = txt.Split(delim,StringSplitOptions.None); + foreach (string str in strlst) + { + PdfPCell cell = new PdfPCell(ConvertDOSSuperAndSubScripts(str, fnt)); + cell.BorderColor = Color.WHITE; + datatable.AddCell(cell); + } + } + + public void AddImage(string filename) + { + ROImageInfo roImage = ROImageInfo.GetByROFstID_FileName(_ROFstID, filename); + PdfPCell spaceCell = new PdfPCell(); + spaceCell.BorderColor = Color.WHITE; + datatable.AddCell(spaceCell); + if (roImage != null) + { + ROImageConfig rc = new ROImageConfig(roImage); + int size = Convert.ToInt32(rc.Image_Size); + iTextSharp.text.Image it_image = iTextSharp.text.Image.GetInstance(ROImageInfo.Decompress(roImage.Content, size)); + it_image.ScaleToFit(_MyPDFWriter.DirectContent.PdfDocument.PageSize.Width - 144, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height - 216); + PdfPCell cell = new PdfPCell(it_image); + cell.BorderColor = Color.WHITE; + datatable.AddCell(cell); + } + else + { + PdfPCell messageCell = new PdfPCell(new Phrase(string.Format("Image File {0} is missing.",filename))); + messageCell.BorderColor = Color.WHITE; + datatable.AddCell(messageCell); + } + } + + public void AddXYPlot(string plotlang) + { + string pngFile = VlnSettings.TemporaryFolder + @"\XYPlot1.png"; + plotlang = plotlang.Replace("`", "\xB0"); + plotlang = plotlang.Replace("\xF8", "\xB0"); + System.Drawing.RectangleF plotRect = MSWordToPDF.CreatePlot(pngFile, plotlang, 600F, MSWordToPDF.FormForPlotGraphics); + iTextSharp.text.Image it_image = iTextSharp.text.Image.GetInstance(pngFile); + it_image.ScaleToFit(_MyPDFWriter.DirectContent.PdfDocument.PageSize.Width - 144, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height - 216); + PdfPCell spaceCell = new PdfPCell(); + spaceCell.BorderColor = Color.WHITE; + datatable.AddCell(spaceCell); + PdfPCell cell = new PdfPCell(it_image); + cell.BorderColor = Color.WHITE; + datatable.AddCell(cell); } public void PrintReport() @@ -41,61 +258,76 @@ namespace Volian.Print.Library bool StopPrinting = false; bool UserTerminate = false; Int16 iRecType = 0; - // Loop until either printing is aborted or end of file. - while (!StopPrinting && (iRecType = RO_df.ReadInteger16()) != -1) + if (RO_df.GetFileLength() > 0) { - Console.WriteLine("Record Type: {0}", iRecType); - switch (iRecType) + // Loop until either printing is aborted or end of file. + while (!StopPrinting && (iRecType = RO_df.ReadInteger16()) != -1) { - case 1: // Set Header - SetHeader(); - break; - case 2: // Push Header - PushHeader(); - break; - case 3: // Pop Header - PopHeader(); - break; - case 4: // RRO Begin - RROBegin(); - break; - case 5: // RRO End - RROEnd(); - break; - case 6: // Msg - Msg(); - break; - case 7: - KeyField(); - break; - case 100: // Text Field - case 101: // Plot Field - Text(); - break; - case 102: // Image Field - ImageFile(); - break; - case 103: // Multi Begin - Display data for setpoints - Multiple(); - break; - case 104: // Multi End - break; - case 0: // Do Nothing - case 255: - Console.WriteLine("Record Type: {0} No Operation", iRecType); - Console.WriteLine("----------------------------------------------"); - break; - default: // Problem - Console.WriteLine("Record Type: {0} Unrecognized record type", iRecType); - StopPrinting = true; ; - UserTerminate = true; - break; - }; - // if a key is pressed and the character is ESC, set stop printing - // flag. - //StopPrinting = CheckKeyboard(0); + //Console.WriteLine("Record Type: {0}", iRecType); + switch (iRecType) + { + case 1: // Set Header + SetHeader(); + break; + case 2: // Push Header + PushHeader(); + break; + case 3: // Pop Header + PopHeader(); + break; + case 4: // RRO Begin + RROBegin(); + break; + case 5: // RRO End + RROEnd(); + break; + case 6: // Msg + Msg(); + break; + case 7: + KeyField(); + break; + case 100: // Text Field - sometimes also XY Plot + Text(); + break; + case 101: // Plot Field + XYPlot(); + break; + case 102: // Image Field + ImageFile(); + break; + case 103: // Multi Begin - Display data for setpoints + Multiple(); + break; + case 104: // Multi End + break; + case 0: // nothing was entered in that field + if (_IncludeEmptyROFields) + NoInformatEntered(); + break; + case 255: + pdfReportDoc.Add(datatable); + pdfReportDoc.NewPage(); + StartNewDataTable(); + //Console.WriteLine("Record Type: {0} No Operation", iRecType); + //Console.WriteLine("----------------------------------------------"); + break; + default: // Problem + //Console.WriteLine("Record Type: {0} Unrecognized record type", iRecType); + StopPrinting = true; ; + UserTerminate = true; + break; + }; + } } - Console.WriteLine("Record Type: {0}\n** Done **", iRecType); + else + { + StartNewDataTable(); + datatable.HeaderRows = 1; + AddText("Selected Referenced Object has no data.", F12); + } + //Console.WriteLine("Record Type: {0}\n** Done **", iRecType); + pdfReportDoc.Add(datatable); return; } @@ -189,28 +421,22 @@ namespace Volian.Print.Library } } - // delete array of widths - //delete [] width; - // set the margin to zero - //margin = 0; // output the table - PutText(buff); - // reset the margin to it's default value - //margin = 5; - Console.WriteLine("Multiple: {0} ", buff); - Console.WriteLine("----------------------------------------------"); + PutHeaderAndText(buff); + //Console.WriteLine("Multiple: {0} ", buff); + //Console.WriteLine("----------------------------------------------"); } public void SetHeader() { string pTmp; - Console.WriteLine("Set Header"); + //Console.WriteLine("Set Header"); // Get the number of header records Int16 iNewCnt = RO_df.ReadInteger16(); - Console.WriteLine("Num Header Records: {0}", iNewCnt); + //Console.WriteLine("Num Header Records: {0}", iNewCnt); // Loop through the headers int iLoop = 0; @@ -227,11 +453,11 @@ namespace Volian.Print.Library // Get the repeat count for the header iTmpRpt = RO_df.ReadInteger16(); - Console.WriteLine("repeat count for header: {0}", iTmpRpt); + //Console.WriteLine("repeat count for header: {0}", iTmpRpt); // Get the text of the header pTmp = RO_df.ReadText(); - Console.WriteLine("Header Text: {0}", pTmp); + //Console.WriteLine("Header Text: {0}", pTmp); if (!pTmp.Equals(Hdrs.strHdrs[iLoop])) { // if the old header does not equal the new header @@ -260,9 +486,9 @@ namespace Volian.Print.Library Hdrs.strHdrs.Add(pTmp); else Hdrs.strHdrs[iLoop] = pTmp; - Console.WriteLine("Value: {0}", Hdrs.repeatCount[iLoop]); - Console.WriteLine("Value Text: {0}", Hdrs.strHdrs[iLoop]); - Console.WriteLine("----------------------------------------------"); + //Console.WriteLine("Value: {0}", Hdrs.repeatCount[iLoop]); + //Console.WriteLine("Value Text: {0}", Hdrs.strHdrs[iLoop]); + //Console.WriteLine("----------------------------------------------"); } // Set the new header count Hdrs.HdrCnt = iNewCnt; @@ -279,12 +505,13 @@ namespace Volian.Print.Library //Hdrs.repeatCount[Hdrs.HdrCnt] = 2; Hdrs.repeatCount.Add(2); Hdrs.HdrCnt++; + Hdrs.printedLastHeader = false; //m_pPrinterOut->PushedHeader(Hdrs.strHdrs[Hdrs.HdrCnt-1]); - Console.WriteLine("Push Header"); - Console.WriteLine("Header Text: {0}", pTmp); - Console.WriteLine("----------------------------------------------"); + //Console.WriteLine("Push Header"); + //Console.WriteLine("Header Text: {0}", pTmp); + //Console.WriteLine("----------------------------------------------"); } public void PopHeader() @@ -306,60 +533,123 @@ namespace Volian.Print.Library Hdrs.strHdrs.RemoveAt(Hdrs.HdrCnt); Hdrs.repeatCount.RemoveAt(Hdrs.HdrCnt); - Console.WriteLine("Pop Header"); - Console.WriteLine("----------------------------------------------"); + //Console.WriteLine("Pop Header"); + //Console.WriteLine("----------------------------------------------"); } public void RROBegin() { //m_pPrinterOut->NewPage(); - Console.WriteLine("RRO Begin"); - Console.WriteLine("----------------------------------------------"); + //Console.WriteLine("RRO Begin"); + //Console.WriteLine("----------------------------------------------"); + // Start of a new RO, print out the headers + for (int iLoop = 0; iLoop < Hdrs.HdrCnt; iLoop++) + { + if (!MyDocOutline.ContainsKey(iLoop) || MyDocOutline[iLoop].MyHeader != Hdrs.strHdrs[iLoop]) + { + PdfOutline parentOutline = null; + if (iLoop == 0) + parentOutline = _MyPDFWriter.DirectContent.RootOutline; + else + parentOutline = MyDocOutline[iLoop - 1].MyOutline; + PdfDestination pdfDest = new PdfDestination(PdfDestination.FITH, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height); + AddOutlineLevel(parentOutline, iLoop, Hdrs.strHdrs[iLoop], pdfDest); + } + AddText(Hdrs.strHdrs[iLoop], F12Bold); // should be bold and first header is centered + } + } + + private void AddOutlineLevel(PdfOutline parentOutline, int iLoop, string hdr, PdfDestination pdfDest) + { + if (MyDocOutline.ContainsKey(iLoop)) + MyDocOutline[iLoop] = new DocOutline(new PdfOutline(parentOutline, pdfDest, hdr), hdr); + else + MyDocOutline.Add(iLoop,new DocOutline(new PdfOutline(parentOutline, pdfDest, hdr), hdr)); } public void RROEnd() { //m_pPrinterOut->PageEnd(); // Remove any headers that are left over - Console.WriteLine("{0} headers cleaned up.", Hdrs.HdrCnt); - Console.WriteLine("RRO End"); - Console.WriteLine("----------------------------------------------"); + //Console.WriteLine("{0} headers cleaned up.", Hdrs.HdrCnt); + //Console.WriteLine("RRO End"); + //Console.WriteLine("----------------------------------------------"); } public void Msg() { + // Set a message to the printer on its own string szStr = RO_df.ReadText(); + PutHeaderAndText(szStr); //m_pPrinterOut->NewLine(1); //m_pPrinterOut->PutChr(szStr); //m_pPrinterOut->NewLine(1); - Console.WriteLine("Message"); - Console.WriteLine("Message Text: {0}", szStr); - Console.WriteLine("----------------------------------------------"); + //Console.WriteLine("Message"); + //Console.WriteLine("Message Text: {0}", szStr); + //Console.WriteLine("----------------------------------------------"); } + public void NoInformatEntered() + { + PutHeaderAndText("-- No information entered --"); + } + + public void PutHeaderAndText(string txt) + { + if (!Hdrs.printedLastHeader) + { + Chunk chk = LastHeader(); + Phrase p = new Phrase(); + PdfPCell cell = new PdfPCell(); + p.Add(chk); // add the header chunk + cell.BackgroundColor = Color.WHITE; + cell.BorderColor = Color.WHITE; + cell.AddElement(p); + datatable.AddCell(cell); + } + PutText(txt); + } public void Text() { // Get the lenght of the text string and read it in Int16 iValue = RO_df.ReadInteger16(); string szStr = RO_df.ReadText(iValue); string temp = szStr; + Chunk chk = LastHeader(); + Phrase p = new Phrase(); + PdfPCell cell = new PdfPCell(); + p.Add(chk); // add the header chunk + cell.BackgroundColor = Color.WHITE; + cell.BorderColor = Color.WHITE; - if ((iValue + curheaderlen) > 72 || (szStr.IndexOf('\r') != -1)) + bool isXYPlot = szStr.StartsWith("< 72 || (szStr.IndexOf('\r') != -1)) { // If the lenght of the string plus the field title is greater // than 72 characters or has a carriage return character in it // then output the text on multiple lines //if (m_pPrinterOut->Row() > 55) // m_pPrinterOut->newpage(); - LastHeader(); - PutText(temp); + + // the header goes on its own line + cell.AddElement(p); + datatable.AddCell(cell); + // text goes below the header + + if (isXYPlot) + AddXYPlot(szStr); // xy plot - sometimes plots were put in text fields + else + PutText(temp); // it's just text } else { - // Otherwise output the text on a single line - LastHeader(); + // Otherwise output the header and text on a single line + p.Add(ConvertDOSSuperAndSubScripts(szStr,F10)); + cell.AddElement(p); + datatable.AddCell(cell); //m_pPrinterOut->SetNumberOfNewLines(0); //m_pPrinterOut->putline(0, temp); //if (m_pPrinterOut->Row() + 1 > 55) @@ -367,18 +657,21 @@ namespace Volian.Print.Library //else // m_pPrinterOut->newline(1); } - Console.WriteLine("Text"); - Console.WriteLine("Value: {0}", iValue); - Console.WriteLine("Text: {0}", szStr); - Console.WriteLine("----------------------------------------------"); + //Console.WriteLine("Text"); + //Console.WriteLine("Value: {0}", iValue); + //Console.WriteLine("Text: {0}", szStr); + //Console.WriteLine("----------------------------------------------"); } public void KeyField() { + // use the key field as the PDF bookbark string szStr = RO_df.ReadText(); - Console.WriteLine("Key Field"); - Console.WriteLine("Key Text: {0}", szStr); - Console.WriteLine("----------------------------------------------"); + PdfDestination pdfDest = new PdfDestination(PdfDestination.FITH, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height); + new PdfOutline(MyDocOutline[Hdrs.HdrCnt - 1].MyOutline, pdfDest, szStr); + //Console.WriteLine("Key Field"); + //Console.WriteLine("Key Text: {0}", szStr); + //Console.WriteLine("----------------------------------------------"); } // Read in the image filename, height, and width @@ -389,11 +682,36 @@ namespace Volian.Print.Library Int16 wd = RO_df.ReadInteger16(); //m_pPrinterOut->PrintImage(fn, wd, ht); - Console.WriteLine("ImageFile"); - Console.WriteLine("Name: {0}", fn); - Console.WriteLine("Height: {0}", ht); - Console.WriteLine("Width: {0}", wd); - Console.WriteLine("----------------------------------------------"); + //Console.WriteLine("ImageFile"); + //Console.WriteLine("Name: {0}", fn); + //Console.WriteLine("Height: {0}", ht); + //Console.WriteLine("Width: {0}", wd); + //Console.WriteLine("----------------------------------------------"); + AddImage(fn); + } +// Read in the X/Y plot info. + public void XYPlot() + { + // Get the lenght of the text string and read it in + Int16 iValue = RO_df.ReadInteger16(); + string szStr = RO_df.ReadText(iValue); + string temp = szStr; + Chunk chk = LastHeader(); // = new Chunk(m.Value, fnt); + Phrase p = new Phrase(); + PdfPCell cell = new PdfPCell(); + p.Add(chk); // add the header chunk + cell.BackgroundColor = Color.WHITE; + cell.BorderColor = Color.WHITE; + + // the header goes on its own line + cell.AddElement(p); + datatable.AddCell(cell); + AddXYPlot(szStr); + + //Console.WriteLine("XY Plot"); + //Console.WriteLine("Value: {0}", iValue); + //Console.WriteLine("Text: {0}", szStr); + //Console.WriteLine("----------------------------------------------"); } // Output the string. If it is a graph, print the graph. @@ -404,10 +722,11 @@ namespace Volian.Print.Library { //m_pPrinterOut->putchr("NONE"); //m_pPrinterOut->newline(2); + AddText("NONE", F10); return; } //m_pPrinterOut->SetNumberOfNewLines(0); - string temp = szStr; + AddText(szStr,F10); //m_pPrinterOut->newline(2); // Include margin so the Display Data can print with a margin of zero //m_pPrinterOut->ParseForGraph(temp, margin); @@ -415,8 +734,16 @@ namespace Volian.Print.Library // Output the last header that was push onto the header stack // Printer::LastHeader contains the code to do this. - public void LastHeader() + public Chunk LastHeader() { + Chunk chk;// = new Chunk(m.Value, fnt); + string hdrtxt = ""; + if (Hdrs.HdrCnt > 0) + hdrtxt = Hdrs.strHdrs[Hdrs.HdrCnt - 1]; + hdrtxt += ": "; + chk = new Chunk(hdrtxt, F10Bold); + Hdrs.printedLastHeader = true; + return chk; //m_pPrinterOut->LastHeader(); } @@ -430,11 +757,13 @@ namespace Volian.Print.Library // public int[] repeatCount; public int HdrCnt; public List repeatCount; + public bool printedLastHeader; public Headers() { HdrCnt = 0; strHdrs = new List(); repeatCount = new List(); + printedLastHeader = false; } } @@ -447,15 +776,27 @@ namespace Volian.Print.Library fs = new FileStream(fname,FileMode.Open); br = new BinaryReader(fs); } + public void close() + { + br.Close(); + fs.Close(); + } + public long GetFileLength() + { + return fs.Length; + } // Read an integer value from the data file public Int16 ReadInteger16() { - // Int16 i16RetValue; - // //if (br == null || br.PeekChar() == -1) // no file handle or end of file - // // return -1; - // i16RetValue = br.ReadInt16(); - //return i16RetValue; - return br.ReadInt16(); + try + { + return (Int16)br.ReadUInt16(); + } + catch (Exception e) + { + Console.WriteLine("Exception : {0}", e.Message); + return -1; + } } // Read a text string from the data file and returns it. // The calling program is responsible for free it @@ -480,7 +821,11 @@ namespace Volian.Print.Library { byte[] charbuff = new byte[i16DataSize + 1]; charbuff = br.ReadBytes(i16DataSize); - return (Encoding.ASCII.GetString(charbuff, 0, i16DataSize)); + string str = ""; + for (int i = 0; i < i16DataSize; i++) + str += Convert.ToChar(charbuff[i]).ToString(); + return (str); + //return (Encoding.ASCII.GetString(charbuff, 0, i16DataSize)); // this didn't handle line draw chars } } @@ -537,19 +882,19 @@ namespace Volian.Print.Library ReadInteger16(); break; } - return fs.Seek(0, SeekOrigin.Current);//ftell(GetFilePointer()); + return fs.Seek(0, SeekOrigin.Current); } // Get the block of data that is the record public byte[] GetRecord(ref int size) { byte[] data; // Get the current position - long lCurPos = fs.Seek(0, SeekOrigin.Current); //ftell(GetFilePointer()); + long lCurPos = fs.Seek(0, SeekOrigin.Current); // Go to the end of the record and get the file position ReadInteger16(); NextRecord(); - long lEndRecord = fs.Seek(0, SeekOrigin.Current); //ftell(GetFilePointer()); + long lEndRecord = fs.Seek(0, SeekOrigin.Current); // Get the size of the record size = (int)(lEndRecord - lCurPos); @@ -557,719 +902,9 @@ namespace Volian.Print.Library // Retrieve the record from the file data = new byte[size +1]; data = br.ReadBytes(size); - //fseek(GetFilePointer(),lCurPos,SEEK_SET); - //fread(data,*size,1,GetFilePointer()); return data; } } - -# region ReportTextOutputer - public class ReportTextOutputer - { - private int NumLinesForGraph, RowForGraph; - private int CurrentGraphicsMode, ShouldBeGraphicsMode; - private int xtralines; - private string LaserGraphicSpcChar = "'" + "\x07"; // degree and bullet - private iTextSharp.text.Document pdfReportDoc; - private int _page = 0; - private int _row = 0; - - public int Row - { - get { return _row; } - //set { _row = value; } - } - private int _nstring = 0; - private int _pitch = 1; - private bool _ItalicsFlag = false; - private bool _PrintTheExponent = true; /* set to false if we do not want exponents printed */ - private bool _boldFlag = false; - private bool _UnderLineFlag = false; - private bool _SubscriptFlag = false; - private bool _SuperScriptFlag = false; - private bool _CompSubscriptFlag = false; - private bool _CompSuperscriptFlag = false; - private int _nnl = 1; - private Header Hdrd = null; - - ReportTextOutputer(iTextSharp.text.Document pdfDoc, Header hdr) - { - pdfReportDoc = pdfDoc; - Hdrd = hdr; - } - - // Set the number of newlines to print when outputting text - public void SetNumberOfNewLines(int iNewLines) - { - _nnl = iNewLines; - } - // Parse for a graph. If no graph then print the text. - // Margin added for multifield print - Display Data for Setpoints - public void ParseForGraph(string szStr, int mrgn) - { - //string temp = szStr; - - //// Look for a graph. If one is found pop it onto the graph stack - // ::ParseForGraph(temp); - - //// Print any text or graphs - //NumLinesForGraph = 0; - //while (*temp) - // { - // RowForGraph = row; - // // Use margin to make function generic - // temp = putline(mrgn,temp); - // } - //newline(1); - - //// Reposition the cursor after the graph is printed - //if (NumLinesForGraph > row) - // newline((NumLinesForGraph-row)+2); - //if (xtralines > 0) newline(xtralines); - - } - // Start a new page - public void NewPage() - { - // newpage(); - pdfReportDoc.NewPage(); - } - // Start a new line - public void NewLine(int iNumberOfLines) - { - newline(iNumberOfLines); - } - // Output a line - public string PutLine(int iMargin, string szStr) - { - return putline(iMargin, szStr); - } - // Output a line in bold - public void Bolder(string szStr) - { - //if (!bold[1]) - // { - // putchr(szStr); - // return; - // } - //putchr(bold[1]); - //putchr(szStr); - //putchr(bold[0]); - } - // End a page - public void PageEnd() - { - pageend(); - } - // Output a date - public void PutDate(string szStr) - { - //putnchr((char *)(szStr+4),2); - //putnchr("/",1); - //putnchr((char *)(szStr+6),2); - //putnchr("/",1); - //putnchr((char *)(szStr+2),2); - } - - // Output a character to the printer - public void PutChr(string szStr) - { - putchr(szStr); - } - - // Set a pointer to the header stack to be used if headers need to - // be accessed - public void SetHeaderInfo(Headers pHdr) - { - //m_pHdrs = pHdr; - //// clear it out too. - //memset(m_pHdrs,0,sizeof(Headers)); - } - // Output a line to the printer - public string putline(int margin, string instr) - { - int loceol; - string str = "";// char[strlen(instr)+1]; - string rtnstr = ""; - str = instr; //strcpy(str,instr); - // Search for newline and zero terminate it - //col=margin; - loceol = str.IndexOf('\n'); //strchr(str,'\n'); - if (loceol > 0) // \n found - { - if (str[loceol + 1] == '\r') loceol++; - if (str[loceol - 1] == '\r') - { - str = str.Substring(0, loceol - 1); - } - else - str = str.Substring(0, loceol); - } - else - loceol = str.Length - 1; - if (str.Length > 67) // see if we need word wrap - { - int x = str.Length - 1; - while ((x > 0) && (str[x] != ' ')) x--; - if (x > 0) - str = str.Substring(0, x + 1); - else - str = str.Substring(0, 67); - rtnstr = instr.Substring(str.Length); - } - // format and output line - FixAndPutLine(str, margin); - - //if (UnderLineFlag) toggle_underline(); - - return (rtnstr); - } - - - // Send 'n' characters to the printer via put1c - public void putnchr(string str, int n) - { - //for (int x=0; x < n; x++) - // put1c(str[x],m_ifile); - } - - // Format and output a string - //private static string aprocname; - public void FixAndPutLine(string str, int margin) - { - //int i,ccol,tcol,JustDoIt; - - ////aprocname = "proc000"; //strcpy(aprocname,"proc000"); - ////dbname = aprocname; - ///*JustDoIt does sub/superscript anywhere if "##" or "~~" is used */ - - //MakeSureFlagsAreOff(); - //if(str != null && str != ""){ - // if(nnl){ - // newline(nnl); - // nnl=0; - // } - // // if not going to a new page, put out the margin. - // if (str[0] != '\f') - // for(i=0;i= '0') && (str[x] <= '9'))){ - // nstring = 1; - // check_super(str); - // } - // else if (str[x] == '~' || str[x] =='#'){ - // JustDoIt=0; - // if(str[x]==str[x+1]){ /* Using ## or ~~ will do super */ - // x++;//str++; /* or subscript regardless of */ - // JustDoIt=1; /* preceding character */ - // } - // if (char.IsLetterOrDigit(str,x-1) || ".)]".IndexOf(str[x-1]) !=-1 || JustDoIt) - // (str[x]=='~')?toggle_subscript() : toggle_SuperScript(); - // else - // putnchr(str,1); - // } - // else if (str[x] == '<' && str[x+1] == '_') // less than or equal - // { - // //LaserGraphics('\345'); - // LaserGraphics('\xE5'); - // x++; - // } - // else if (str[x] == '>' && str[x+1] == '_') // greater than or equal - // { - // //LaserGraphics('\344'); - // LaserGraphics('\xE4'); - // x++; - // } - // else if (str[x] == '+' && str[x+1] == '_') // plus minus - // { - // //LaserGraphics('\343'); - // LaserGraphics('\xE3'); - // x++; - // } - // else if(str[x] == '|'){ - // if (str[x+1] == '^' || str[x+1] == 'v') // up arrow or down arrow - // x++; - // LaserGraphics(*str); // ??? - // ccol++; - // } - // else if (str[x] == 0xF2) - // //LaserGraphics('\344'); /* greater equal */ - // LaserGraphics('\xE4'); /* greater equal */ - // else if (str[x] == 0xE4) - // //LaserGraphics('\372'); /* sigma */ - // LaserGraphics('\xFA'); /* sigma */ - // else if (str[x] == 0xE5) - // LaserGraphics(0xFD); /* sigma */ - // else if (str[x] == 0xF6) - // //LaserGraphics('\241'); /* division symbol */ - // LaserGraphics('\xA1'); /* division symbol */ - // else if (str[x] == 0xFB) - // //LaserGraphics('\243'); /* sqr root */ - // LaserGraphics('\xA3'); /* sqr root */ - // else if (str[x] == 0xE3) - // //LaserGraphics('\244'); /* pi */ - // LaserGraphics('\xA4'); /* pi */ - // else if ((str[x] == '^')||(str[x] == 0x7F)) - // LaserGraphics(0x7F); - // else if (str[x] == 0xF9) /* Note box char - only FPL format */ - // LaserGraphics(0xAD); - // else if (str[x] == '`') /* bullet */ - // LaserGraphics(0xB8); - // else if (str[x] == 0xE0) /* up arrow */ - // LaserGraphics(0x18); - // else if (str[x] == 0xE1) /* down arrow */ - // LaserGraphics(0x19); - // else if (str[x] == 0xAA) /* approx equal */ - // LaserGraphics(0xEF); - // else if (str[x] == 0xA6) /* border char */ - // LaserGraphics(0xB5); - // else if (str[x] == 0xA2) /* Distinguished zero */ - // LaserGraphics(0xED); - // else if(str[x] == MARKGRAPH){ - // int grln = PopAGraph(0); - // if (grln+row>59) newpage(); - // PrintGraphString(); - // RowForGraph+=grln+2; - // //RowForGraph+=PopAGraph()+2; - // flushbuf(); - // NumLinesForGraph=max(NumLinesForGraph,RowForGraph); - // put1c(0x20,m_iFile); - // if( fonts[PICA] ) putchr(fonts[PICA]); - // } - // else if (str[x] > 0x7F || LaserGraphicSpcChar.IndexOf(str[x]) != -1)//strchr(LaserGraphicSpcChar,str[x])) - // LaserGraphics(str[x]); - // //else if (str[x] == '\033'){ /*ESC */ - // else if (str[x] == '\x1B'){ /*ESC */ - // if((str[x+1]=='4') || (str[x+1]=='5')){ - // T_Italics(); - // x++; - // } - // else if (str[x+1]=='0'){ /* 16 lpi */ - // putchr(Lpi[LPI16]); - // x++; - // } - // else if (str[x+1]=='2'){ /* 12 lpi */ - // putchr(Lpi[LPI12]); - // x++; - // } - // else if (str[x+1]=='P'){ /* ESC P=Toggle Elite/Pica */ - // toggle_pitch(); - // x++; - // } - // else if (str[x+1]=='F'){ - // putchr(fonts[ELITE]); - // x++; - // } - // else if (str[x+1]=='\\' && str[x+2]=='#'){ - // putchr("#"); - // x++; - // } - // else if (str[x+1]=='#' || str[x+1]=='~'){ - // /* Compressed Super/subscripting tokens are the same as - // ** normal sub/superscripting except preceded by ESC */ - // x++; - // if (str[x]=='~') - // Toggle_CompSubscript(); - // else Toggle_CompSuperscript(); - // } - // else { - // putnchr(str[x],1); - // }; - // } - // else{ - // if(str[x] == ' ')nstring = 0; - // if(str[x] == '\f') - // newpage(); - // //else if(str[x] == '\017'){ /* Compress on with CTRL O */ - // else if(str[x] == '\x0F'){ /* Compress on with CTRL O */ - // putchr(CompressMode[1]); - // pitch=0; /* Compressed mode shuts elite off */ - // } - // //else if(str[x] == '\022') /* Compress off with CTRL R */ - // else if(str[x] == '\x12') /* Compress off with CTRL R */ - // putchr(CompressMode[0]); - // else{ - // putnchr(str[x],1); - // ccol++; - // } - // } - // x++; - // if(ccol >= tcol)tcol+=8; - // } - - // nnl=1; - // } - //else - // nnl++; - //put1c(-1,m_iFile); /* resets graphics mode if necessary */ - } - - // Turn off all of the flags for formating - public void MakeSureFlagsAreOff() - { - //if (UnderLineFlag) - // toggle_underline(); - //if (boldFlag) - // toggle_bold(); - //if (SubscriptFlag) - // toggle_subscript(); - //if (SuperScriptFlag) - // toggle_SuperScript(); - } - - // Write a character to the printer - public void put1c(int ch, int fp) - { - //if(CurrentGraphicsMode!=ShouldBeGraphicsMode){ - // if((CurrentGraphicsMode=ShouldBeGraphicsMode)!=0) - // putchr(LaserGraphicsOn); - // else - // putchr(LaserGraphicsOff); - // } - //if(ch!=-1) - // { - // char character = ch; - // write(fp, &character, 1); - // } - } - - public void doheaders(int i, int flag) - { - //int nSpaces; - //if(m_pHdrs->m_iRepeatCount[i]==2){ - // m_pHdrs->m_iRepeatCount[i]=0; - //} else { - // if( flag ) nSpaces = flag; - // else nSpaces = (i-1)*2; - // for(int j=0;jm_pHdrs[i]); - // if(m_pHdrs->m_iRepeatCount[i]==1){ - // if( !flag ) putchr(" (continued)"); - // } else { - // m_pHdrs->m_iRepeatCount[i]++; - // } - // newline(1); - //} - } - // Start a new page - public void newpage() - { - //string szPageNumber = ""; - //// Increment page number - //page++; - - //// End the page if not at the top - //if(row > 0) PageEnd(); - - //// Put out the font command for PICA on every page. - //if (fonts[PICA] != null) putchr(fonts[PICA]); - - //// Print 3 lines - //newline(3); - //// if( !StupidHP )newline(2); - //newline(2); - - //// Print main header with a page number - //putchr(topheader); - ////sprintf(szPageNumber," %d",page); - ////putchr(szPageNumber); - - //NewLine(1); - - //// Print all of the header in the header stack - //int i; - //if(m_pHdrs->m_iHdrCnt){ - // NewLine(1); - // doheaders(0,max(0,(int)(35-strlen(m_pHdrs->m_pHdrs[0])/2))); - // NewLine(1); - // for(i=1;im_iHdrCnt;i++){ - // doheaders(i); - // } - // newline(1); - //} - } - // End the page - public void pageend() - { - //// Send Carriage return/new line and form feed - //putchr("\r\n"); - //putchr("\014"); // form feed - - // Home the cursor - //row = 0; - //col = 0; - } - // Start a new line - public void newline(int n) - { - _row += n; - // col=0; - if (_row > 59) - { - newpage(); - return; - } - while (n-- > 0) putnchr("\r\n", 2); - // This spaces over for a left margin - putchr(" "); // make a 3/4 inch left margin (at 10 chars per inch) - } - - // Toggle Underline - public void toggle_underline() - { - //UnderLineFlag= !UnderLineFlag; - //putchr(underline[UnderLineFlag]); - } - - // Toggle Bold - public void toggle_bold() - { - //boldFlag = !boldFlag; - //putchr(bold[boldFlag]); - } - // Toggle Subscript - public void toggle_subscript() - { - //SubscriptFlag = !SubscriptFlag; - //if (SuperScriptFlag) SuperScriptFlag = 0; - //putchr(SubScript[SubscriptFlag]); - } - - // Toggle SuperScript - public void toggle_SuperScript() - { - //SuperScriptFlag = !SuperScriptFlag; - //if (SubscriptFlag) SubscriptFlag = 0; - //putchr(SuperScript[SuperScriptFlag]); - } - - public void Toggle_CompSubscript() - /* Toggle compressed mode subscript. Also reduce line spacing so that - ** when shrink printer command does its half line movement, it does not - ** cause subscripted text to print over the next line */ - { - //if (CompSubscriptFlag ^= 1) - // putchr(Lpi[LPI12]); - //if (CompSuperscriptFlag) CompSuperscriptFlag = 0; - //if (SuperScriptFlag) SuperScriptFlag = 0; - //putchr(shrink[1][CompSubscriptFlag]); - //if (!CompSubscriptFlag) - // putchr(Lpi[LPI6]); /* Set to 6 lines per inch - assumes default */ - } - public void Toggle_CompSuperscript() - /* Toggle compressed mode superscript. Also reduce line spacing so that - ** when shrink printer command does its half line movement, it does not - ** cause superscripted text to print over the next line */ - { - //if (CompSuperscriptFlag ^= 1) - // putchr(Lpi[LPI12]); - //if (CompSubscriptFlag) CompSubscriptFlag = 0; - //if (SubscriptFlag) SubscriptFlag = 0; - //putchr(shrink[0][CompSuperscriptFlag]); - //if (!CompSuperscriptFlag) - // putchr(Lpi[LPI6]); /* Set to 6 lines per inch - assumes default */ - //} - - } - public void check_super(string lstr) //char **lstr) - { - //if(!FortranFormatNumbers && IsAnENumber(*lstr) && PrintTheExponent) - //{ - // if(IsPowerOf10(*lstr)){ - // putnchr("10",2); - // while(**lstr!='E')(*lstr)++; - // } - // else{ - // while(**lstr != 'E'){ - // putnchr(*lstr,1); - // (*lstr)++; - // } - // putnchr("x10",3); - // } - // (*lstr)++; - // toggle_SuperScript(); - // while(isdigit(**lstr) || **lstr=='+' || **lstr=='-' || **lstr=='.'){ - // putnchr(*lstr,1); - // (*lstr)++; - // } - // toggle_SuperScript(); - // (*lstr)--; - // } - //else - //putnchr(*lstr,1); - } - public int IsAnENumber(string str) - { - //while(isdigit(*str))str++; - //if(*str++ != '.')return(0); - //while(isdigit(*str))str++; - //if(*str++ != 'E')return(0); - //if(*str=='+' || *str=='-')str++; - //while(isdigit(*str))str++; - //if(*str == '.')str++; - //while(isdigit(*str))str++; - //if(!isalpha(*str))return(1); - return (0); - } - - public int IsPowerOf10(string str) - { - //if(*str++!='1')return(0); - //if(*str++!='.')return(0); - //while(*str=='0')str++; - //if(*str!='E')return(0); - return (1); - } - public void toggle_pitch() - { - //pitch= !pitch; - //putchr(PrnPitch[pitch]); - } - public void LaserGraphics(char GraphicsChar) - { - /** Bug fix B2004-002 - let VFW handle the underlining - ** of special characters - int localtoggle; - if ((localtoggle = UnderLineFlag) != 0) toggle_underline(); - **/ - //ShouldBeGraphicsMode=1; - //put1c(GraphicsChar, m_iFile); - //ShouldBeGraphicsMode=0; - /** Bug fix B2004-002 - if (localtoggle){ - putnchr("\008",1); * backspace * - toggle_underline(); * resume underlining * - putnchr(" ",1); * send space * - } - **/ - } - public void putchr(string str) - { - //putnchr(str,strlen(str)); - } - - public void T_Italics() - { - //putchr(SetItalics[(ItalicsFlag^=1)]); - } - public void PrintImage(string fn, int x, int ht) - { - // char pth[MAXPATH]; - // if (row + ht > 59) newpage(); - // LastHeader(); - - // char *cmdstr, *buf; - // cmdstr = (char *) mallocq(81); - - // char bits[4]; - // // See if we are using the new (32-bit) RO Editor - // memset(bits,'\0',4); - // (void) GetPrivateProfileString("RoEditor","Bit","32", - // bits,sizeof(bits),ExeAdjust("~veproms.ini")); - // /* - // * Since we might be printing out of the APPROVED directory, - // * let the default graphic file extension be PCX. If the - // * graphic file cannot be found, then see if there is a TIF - // * version of the graphic file (converted for the 32-bit RO - // * Editor). Note that when we convert RO graphic files from - // * PCX to TIF, we only do the ones in the RO directory, not any - // * of the "approved" graphic files in the APPROVED directory. - // * So until VFW is running totally under .NET, we need check - // * for both PCX and TIF graphic files when printing. - // */ - - // int k=1; - // buf = (char *) mallocq(5); - // if (strcmp(bits,"32")== 0) - // { - // (void)GetPrivateProfileString("Graphics", "defaultext", "TIF", buf, 4, - // ExeAdjust("~veproms.ini")); - // } - // else - // { - // (void)GetPrivateProfileString("Graphics", "defaultext", "PCX", buf, 4, - // ExeAdjust("~veproms.ini")); - // } - // if (strchr(fn, '.') == NULL) { - // sprintf(pth,"%s%s.%s",GetGraphicsPath(),fn,buf); - // } else { - // sprintf(pth,"%s%s",GetGraphicsPath(),fn); - // } - // if(Exists(pth)){ - // sprintf(cmdstr,"\255I\"%s:.\\%d:%d\"",pth,k,ht*DeciPerRow); - // } else { - // /* - // * The graphic file was not found but we might be printing out - // * of the APPROVED directory. Set the graphic file extension - // * be PCX. - // * Note that when we convert RO graphic files from - // * PCX to TIF, we only do the ones in the RO directory, not any - // * of the "approved" graphic files in the APPROVED directory. - // * So until VFW is running totally under .NET, we need check - // * for both PCX and TIF graphic files when printing. - // */ - // if (InApproved() && (strcmp(bits,"32")== 0)) - // { - // // we are the Approved directory. - // // Graphics file does not exist, try the graphic file - // // name with a PCX extension - // char *tptr = strrchr(pth,'.'); - // if (tptr != NULL) - // strcpy(tptr,".PCX"); // see if a TIF version exists - // } - // if (Exists(pth)) { - // sprintf(cmdstr,"\255I\"%s:%s%d:%d\"",pth,k,ht*DeciPerRow); - // } - // else// Output message if file does not exist - // sprintf(cmdstr,"%s does not exist.",pth); - // } - // putchr(cmdstr); - // free(buf); - // free(cmdstr); - // row += ht; - //#ifdef OUTPUT_DEBUG_INFO - // cout << cmdline << endl; - //#endif - } - - // Print the last header in the header stack - public void LastHeader() - { - //string buf; - //if (m_pHdrs->m_iHdrCnt > 0) - // { - // // Advance a line on the printer - // NewLine(1); - - // // Copy colon to the header string and print it in bold - // strcpy(buf, m_pHdrs->m_pHdrs[m_pHdrs->m_iHdrCnt-1]); - // strcat(buf, ": "); - // Bolder(buf); - - // // Set repeat count to 1 for the header - // m_pHdrs->m_iRepeatCount[m_pHdrs->m_iHdrCnt-1] =1; - // } - } - public void PushedHeader(string szStr) - { - //UserTerminate = CheckKeyboard(szStr); - } - } -#endregion } diff --git a/PROMS/Volian.Print.Library/PDFReport.cs b/PROMS/Volian.Print.Library/PDFReport.cs index c5c96d3c..a3ba5566 100644 --- a/PROMS/Volian.Print.Library/PDFReport.cs +++ b/PROMS/Volian.Print.Library/PDFReport.cs @@ -21,7 +21,7 @@ namespace Volian.Print.Library ReferencedObjectSummary = 4, ReferencedObjectComplete = 5 } - + private PdfWriter _MyPdfWriter; private ICollection _ResultList; public ICollection ResultList { @@ -72,6 +72,8 @@ namespace Volian.Print.Library private List _ROList; private ROFSTLookup _ROFSTLookup; private bool _IncludeMissingROs = false; + private bool _ConvertCaretToDelta = true; + private bool _IncludeEmptyROFields = false; // Search Results Report public PDFReport(string reportTitle, string typesSelected, ICollection resultList, string fileName) @@ -95,7 +97,7 @@ namespace Volian.Print.Library _ByLine = "Generated By PROMS"; } - // Transition and RO Usage + // RO Usage public PDFReport(string reportTitle, ICollection resultList, string fileName, bool sortUsageByProcedure, bool includeMissingROs) { _ResultList = resultList; @@ -107,14 +109,17 @@ namespace Volian.Print.Library _IncludeMissingROs = includeMissingROs; } - // RO Complete Report - public PDFReport(string reportTitle, string roDataFile, string outfile, bool completeReport) + // RO Complete RO Report + public PDFReport(string reportTitle, string roDataFile, string outfile, ROFSTLookup fstlookup, bool completeReport, bool convertCaretToDelta, bool includeEmptyROFields) { _FileName = outfile; _ReportTitle = reportTitle; _ReportType = (int)ReportType.ReferencedObjectComplete; - _ByLine = "Complete RO Report"; + _ByLine = "Complete Referenced Objects Report"; _RODataFile = roDataFile; + _ConvertCaretToDelta = convertCaretToDelta; + _ROFSTLookup = fstlookup; + _IncludeEmptyROFields = includeEmptyROFields; } // RO Summary Report @@ -128,112 +133,6 @@ namespace Volian.Print.Library _ROList = roList; } - //public void Build2() - //{ - // iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LETTER, 36, 36, 36, 36); - // try - // { - // PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(_FileName, FileMode.Create)); - - // // we add some meta information to the document - // document.SetMargins(36, 36, 36, 36); - // // step 3: we open the document - // document.Open(); - // AddTable(document, 20, 80); - // //AddTable(document, 10, 90); - // //AddTable(document, 10, 100); - // //AddTable(document, 15, 75); - // //AddTable(document, 20, 70); - // //AddTable(document, 25, 65); - // //AddTable(document, 30, 60); - // document.Close(); - // } - // catch (Exception ex) - // { - // } - //} - - //private void AddTable(iTextSharp.text.Document document, int width1, int width2) - //{ - // float[] headerwidths = { width1, width2 }; - // PdfPTable datatable = new PdfPTable(headerwidths); - // datatable.HeaderRows = 3; - // datatable.FooterRows = 1; - // //datatable.Padding = 4; - // //datatable.DefaultCell.Padding = 4; - // //datatable.Spacing = 0; - // //datatable.setBorder(Rectangle.NO_BORDER); - // //datatable.Widths = headerwidths; - // //datatable.WidthPercentage = 100; - // datatable.TotalWidth = (width1 + width2) * 5; - // datatable.LockedWidth = true; - // // the first cell spans 10 columns - // //iTextSharp.text.Font f1 = FontFactory.GetFont("Arial Unicode MS", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 14, Font.BOLD); - // iTextSharp.text.Font f1 = pdf.GetFont("Arial Unicode MS", 14, 1, Color.BLACK); - - // PdfPCell cell = new PdfPCell(new Phrase(ReportTitle, f1)); - // //Font f2 = FontFactory.GetFont(FontFactory.HELVETICA, 10); - // //FontFactory.RegisterDirectory(FontFind.FontDir); - // //iTextSharp.text.Font f2 = FontFactory.GetFont("Arial Unicode MS", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 10); - // iTextSharp.text.Font f2 = pdf.GetFont("Arial Unicode MS", 10, 0, Color.BLACK); - // //iTextSharp.text.Font f3 = FontFactory.GetFont("Prestige Elite Tall", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 9); - // iTextSharp.text.Font f3 = pdf.GetFont("Prestige Elite Tall", 9, 0, Color.BLACK); - // cell.HorizontalAlignment = Element.ALIGN_CENTER; - // //cell.Leading = 20; - // cell.Colspan = 2; - // //cell.Border = Rectangle.NO_BORDER; - // cell.BackgroundColor = new Color(0xD0, 0xF0, 0xF0); - // datatable.AddCell(cell); - // Color subHeaderColor = new Color(0xD0, 0xF0, 0xD0); - // // These cells span 2 rows - // //datatable.DefaultCellBorderWidth = 2; - // //datatable.DefaultHorizontalAlignment = 1; - // //datatable.DefaultRowspan = 2; - // datatable.DefaultCell.Padding = 4; - // datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER; - // AddCell(datatable, "Step", f2, subHeaderColor); - // AddCell(datatable, "Text", f2, subHeaderColor); - // AddCell(datatable, "Step", f2, subHeaderColor); - // AddCell(datatable, "Text", f2, subHeaderColor); - // datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT; - // //datatable.DefaultCellBorderWidth = 1; - // //datatable.DefaultRowspan = 1; - // //datatable.DefaultHorizontalAlignment = Element.ALIGN_LEFT; - // string lastDvPath = ""; - // string lastPath = ""; - // Color AnnoColor = new Color(0xFF, 0xFF, 0xC0); - // Color TextColor = Color.WHITE; - // Color SectColor = Color.LIGHT_GRAY; - // foreach (ItemInfo item in _ResultList) - // { - // if (item.SearchDVPath != lastDvPath) - // AddGroup(datatable, item.SearchDVPath, lastDvPath, f2, false, new Color(0xC0, 0xFF, 0xC0)); - // lastDvPath = item.SearchDVPath; - // //if (item.SearchPath != lastPath) - // string stepPath = AddGroup(datatable, item.SearchPath, lastPath, f2, true, new Color(0xE0, 0xFF, 0xE0)); - // lastPath = item.SearchPath; - // AddCell(datatable, stepPath, f2, (item.IsSection ? SectColor : TextColor)); - // if (item.DisplayText.Contains("|")) // Need a better way to determine if it is a table. - // AddCell(datatable, item.DisplayText, f3, TextColor); - // else - // AddCell(datatable, item.DisplayText, f2, (item.IsSection ? SectColor : TextColor)); - // if (item.ItemAnnotationCount > 0) - // { - // foreach (AnnotationInfo ai in item.ItemAnnotations) - // { - // AddCell(datatable, ai.MyAnnotationType.Name, f2, AnnoColor); - // AddCell(datatable, ai.SearchText, f2, AnnoColor); - // } - // } - // } - // document.Add(datatable); - //} - //private static void AddCell(PdfPTable datatable, string str, iTextSharp.text.Font fnt, Color bgColor) - //{ - // PdfPCell cell = new PdfPCell(new Phrase(str, fnt)); - // cell.BackgroundColor = bgColor; - // datatable.AddCell(cell); - //} private string AddGroup(PdfPTable datatable, string dvPath, string lastDvPath, Font f2, bool StripLast, Color bgColor, bool skipFirst) { int level = 0; @@ -297,23 +196,8 @@ namespace Volian.Print.Library string[] NewPath = path.Split("\x7".ToCharArray()); string pnumtitle = NewPath[1]; pnumtitle = pnumtitle.Replace('\x11', ' '); - //return NewPath[1].Replace("\x11:"," "); return pnumtitle; } - //private string GetCurSectionNumTitle(string path) - //{ - // string[] NewPath = path.Split("\x7".ToCharArray()); - // int idx = 2; //start of section and subsection num and title - // int stpidx = NewPath.Length - 1; // last position is the step number - // string rtnstr = ""; - // while (idx < stpidx) - // { - // rtnstr += NewPath[idx++]; - // if (idx < stpidx) - // rtnstr += "\n "; - // } - // return rtnstr; // srting containing section and subsection number/titles - //} private string GetCurSectionNumTitle(ItemInfo itm) { string rtnstr = ""; @@ -476,8 +360,8 @@ namespace Volian.Print.Library string fileName = _FileName.ToLower().Replace(".pdf", suffix + ".pdf"); try { - PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(fileName, FileMode.Create)); - writer.PageEvent = new MyPageHelper(_ByLine); // JSJ - 7/8/2011 + _MyPdfWriter = PdfWriter.GetInstance(document, new FileStream(fileName, FileMode.Create)); + _MyPdfWriter.PageEvent = new MyPageHelper(_ByLine); // JSJ - 7/8/2011 document.SetMargins(36, 36, 36, 36); document.Open(); _FileName = fileName; @@ -529,35 +413,25 @@ namespace Volian.Print.Library //datatable.FooterRows = 1; datatable.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin; datatable.LockedWidth = true; - //FontFactory.RegisterDirectory(FontFind.FontDir); - //iTextSharp.text.Font f1 = FontFactory.GetFont("Arial Unicode MS", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 14, Font.BOLD); - //iTextSharp.text.Font f2 = FontFactory.GetFont("Arial Unicode MS", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 10); - //iTextSharp.text.Font f3 = FontFactory.GetFont("Prestige Elite Tall", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 9); iTextSharp.text.Font f1 = pdf.GetFont("Arial Unicode MS", 14, 1, Color.BLACK); iTextSharp.text.Font f2 = pdf.GetFont("Arial Unicode MS", 10, 0, Color.BLACK); iTextSharp.text.Font f3 = pdf.GetFont("Arial Unicode MS", 12, 0, Color.BLACK); - //iTextSharp.text.Font f3 = pdf.GetFont("Prestige Elite Tall", 9, 0, Color.BLACK); PdfPCell cell = new PdfPCell(new Phrase(ReportTitle, f1)); cell.HorizontalAlignment = Element.ALIGN_CENTER; - //cell.Colspan = 2; cell.BackgroundColor = new Color(0xD0, 0xF0, 0xF0); datatable.AddCell(cell); cell = new PdfPCell(new Phrase(TypesSelected, f3)); cell.HorizontalAlignment = Element.ALIGN_LEFT; - //cell.Colspan = 2; cell.BackgroundColor = new Color(0xD0, 0xF0, 0xF0); datatable.AddCell(cell); BuildSearchResultsProcSetList(); datatable.HeaderRows = 3 + (ProcSetList.Count == 1 ? 1 : 0); int splitAt = FindSpitLevel(); // find the split level of the common path - for all procedure sets that use these library documents - //AddMainPathGroup(datatable, ProcSetList[0].ToString(), splitAt, f2, Color.LIGHT_GRAY, 0); Color subHeaderColor = new Color(0xD0, 0xF0, 0xD0); datatable.DefaultCell.Padding = 4; datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER; - //AddCell(datatable, "Step", f2, subHeaderColor); - //AddCell(datatable, "Text", f2, subHeaderColor); AddCell(colHeader, "Step", f2, subHeaderColor); AddCell(colHeader, "Text", f2, subHeaderColor); //datatable.AddCell(colHeader); @@ -565,7 +439,6 @@ namespace Volian.Print.Library //AddCell(datatable, "Step", f2, subHeaderColor); //AddCell(datatable, "Text", f2, subHeaderColor); datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT; - //string lastDvPath = ""; string lastPath = ""; Color AnnoColor = new Color(0xFF, 0xFF, 0xC0); Color TextColor = Color.WHITE; @@ -591,16 +464,8 @@ namespace Volian.Print.Library subTable = new PdfPTable(headerwidths); } lastProcNum = curProcNum; - //if (item.SearchDVPath != lastDvPath) - // AddGroup(datatable, item.SearchDVPath, lastDvPath, f2, false, Color.LIGHT_GRAY, true); - - //AddGroup(datatable, item.SearchDVPath, lastDvPath, f2, false, new Color(0xC0, 0xFF, 0xC0), true); - //lastDvPath = item.SearchDVPath; - //string stepPath = AddGroup(datatable, item.SearchPath, lastPath, f2, true, new Color(0xE0, 0xFF, 0xE0), true); - //string stepPath = AddGroup(datatable, item.SearchPath, lastPath, f2, true, new Color(0xC0, 0xFF, 0xC0), true); string stepPath = AddGroup(subTable, item.SearchPath ?? item.ShortPath, lastPath, f2, true, new Color(0xC0, 0xFF, 0xC0), true); lastPath = item.SearchPath ?? item.ShortPath; - //AddCell(datatable, stepPath, f2, (item.IsSection ? SectColor : TextColor)); stepPath = BuildStepTab(item); AddCell(subTable, stepPath, f2, (item.IsSection ? SectColor : TextColor)); // This was for the old 16-bit style of table - jsj 7/7/2011 @@ -613,8 +478,6 @@ namespace Volian.Print.Library { foreach (AnnotationInfo ai in item.ItemAnnotations) { - //AddCell(datatable, ai.MyAnnotationType.Name, f2, AnnoColor); - //AddCell(datatable, ai.SearchText, f2, AnnoColor); AddCell(subTable, ai.MyAnnotationType.Name, f2, AnnoColor); AddCell(subTable, ai.SearchText, f2, AnnoColor); } @@ -730,8 +593,6 @@ namespace Volian.Print.Library Color subHeaderColor = new Color(0xD0, 0xF0, 0xD0); datatable.DefaultCell.Padding = 4; datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER; - //AddCell(datatable, "Procedure", f2, subHeaderColor); - //AddCell(datatable, "Section", f2, subHeaderColor); AddCell(colheader, "Procedure", f2, subHeaderColor); AddCell(colheader, "Section", f2, subHeaderColor); datatable.AddCell(colheader); @@ -740,30 +601,18 @@ namespace Volian.Print.Library Color AnnoBackgroundColor = new Color(0xFF, 0xFF, 0xC0); Color TextBackgroundColor = Color.WHITE; Color NotUsedBackgroundColor = Color.WHITE; - //BuildProcSetList(); - //int splitAt = FindSpitLevel(); // find the split level of the common path - for all procedure sets that use these library documents - //bool doMainProcSetpath = true; foreach (DocumentInfo di in _LibDocList) { PdfPTable subtable = new PdfPTable(headerwidths); subtable.HeaderRows = 0; - //if (doMainProcSetpath) - //{ - // AddMainPathGroup(datatable, ProcSetList[0].ToString(), splitAt, f2, Color.LIGHT_GRAY, 0);//2); - // doMainProcSetpath = false; - //} - //AddGroup(datatable, di.DocumentTitle, "", f2, false, new Color(0xC0, 0xFF, 0xC0)); // Library Document Title AddGroup(subtable, di.DocumentTitle, "", f2, false, new Color(0xC0, 0xFF, 0xC0), false); // Library Document Title if (di.DocumentConfig.LibDoc_Comment != null && di.DocumentConfig.LibDoc_Comment.Length > 0) { - //AddCell(datatable, "Comment", f2, AnnoBackgroundColor); - //AddCell(datatable, di.DocumentConfig.LibDoc_Comment, f2, AnnoBackgroundColor); // lib doc comment AddCell(subtable, "Comment", f2, AnnoBackgroundColor); AddCell(subtable, di.DocumentConfig.LibDoc_Comment, f2, AnnoBackgroundColor); // lib doc comment } if (di.DocumentEntries == null || di.DocumentEntries.Count == 0) { - //AddColSpanCell(datatable, "*No References To This Library Document", f2, NotUsedBackgroundColor, 2, Element.ALIGN_LEFT); AddColSpanCell(subtable, "*No References To This Library Document", f2, NotUsedBackgroundColor, 2, Element.ALIGN_LEFT); } else @@ -775,15 +624,9 @@ namespace Volian.Print.Library string ProcNumber = item.MyProcedure.ProcedureConfig.Number; ProcNumber = ProcNumber.Replace(@"\u8209?", "-"); // repace unicode with dash char ProcNumber = ProcNumber.Replace(@"\u160?", " "); // replace Hard Space with normal Space - //if (item.SearchDVPath != lastDvPath) - // AddGroup(datatable, item.SearchDVPath, lastDvPath, f2, false, Color.LIGHT_GRAY);//new Color(0xC0, 0xFF, 0xC0)); - //if (item.SearchDVPath != lastDvPath) - // AddSubPathGroup(datatable, item.SearchDVPath,splitAt, f2, Color.LIGHT_GRAY, 2);//new Color(0xC0, 0xFF, 0xC0)); if (item.SearchDVPath != lastDvPath) AddSubPathGroup(subtable, item.SearchDVPath, splitAt, f2, Color.LIGHT_GRAY, 2);//new Color(0xC0, 0xFF, 0xC0)); lastDvPath = item.SearchDVPath; - //AddCell(datatable, ProcNumber, f2, TextBackgroundColor); - //AddCell(datatable, item.MyContent.Number + " - " + item.MyContent.Text, f2, TextBackgroundColor); AddCell(subtable, ProcNumber, f2, TextBackgroundColor); AddCell(subtable, item.MyContent.Number + " - " + item.MyContent.Text, f2, TextBackgroundColor); } @@ -794,7 +637,6 @@ namespace Volian.Print.Library } private void AddROUsages(ItemInfo item, Dictionary> roUse) { - //string lastROid = ""; if (item.FoundROID != null && item.FoundROID != "") { string roid = item.FoundROID; @@ -820,16 +662,6 @@ namespace Volian.Print.Library { if (rotitle == "") { - //ROFSTLookup myrofstlookup = itm.MyDocVersion.DocVersionAssociations[0].MyROFst.ROFSTLookup; - //List roTitleList = myrofstlookup.GetROTitleAndGroupPath(roKey); - //for (int cnt = 0; cnt < roTitleList.Count; cnt++) - //{ - // if (cnt == roTitleList.Count - 1) - // //rotitle += string.Format("<{0}> {1} {2}", myrofstlookup.GetRoACID(roKey), myrofstlookup.GetTranslatedRoValue(roKey, true), roTitleList[cnt]); - // rotitle += roTitleList[cnt]; - // else - // rotitle += roTitleList[cnt] + "\n "; - //} rotitle = GetROTitleAndGroup(roKey, itm); if (rotitle != null && rotitle != "") { @@ -840,7 +672,6 @@ namespace Volian.Print.Library ROTitleCell.BackgroundColor = Color.PINK; else ROTitleCell.BackgroundColor = new Color(0xDC, 0xE7, 0xC9); //new Color(0xD0, 0xF0, 0xD0);//ligt green //new Color(0xC8, 0xC8, 0x91);//(0xAF, 0xD8, 0xD8);//(0xF5, 0xE4, 0xA0); - //curTable.AddCell(ROTitleCell); // put RO value and description rotable.AddCell(ROTitleCell); // put RO value and description } } @@ -850,9 +681,6 @@ namespace Volian.Print.Library stepnum = itm.MyActiveSection.DisplayNumber; else stepnum = BuildStepTab(itm);//GetStepNumberFromSearchPath(itm.SearchPath);//stepnum.Substring(itm.SearchPath.LastIndexOf(sectitle) + sectitle.Length +1); - // stepnum = stepnum.Substring(stepnum.LastIndexOf("\a") + 1); - //AddCell(curTable, stepnum, f2, Color.WHITE); - //AddCell(curTable, itm.DisplayText, f2, Color.WHITE); AddCell(rotable, stepnum, f2, Color.WHITE); AddCell(rotable, itm.DisplayText, f2, Color.WHITE); } @@ -905,7 +733,6 @@ namespace Volian.Print.Library return thisTab; string typeName = stpinfo.FormatStepData.StepEditData.TypeMenu.MenuItem;//stpinfo.FormatStepData.ToString(); // remove delimiters of '.' and ')' in tab. - //if (thisTab != null && !hasDelim) if (thisTab != null) { // get list of delimiters to remove from the format: @@ -938,7 +765,6 @@ namespace Volian.Print.Library else { thisTab = thisTab.Trim(" ".ToCharArray()); - //sret = "." + thisTab + " " + pitem.Ordinal.ToString() + sret; sret = thisTab + " " + pitem.Ordinal.ToString() + sret; } } @@ -947,12 +773,10 @@ namespace Volian.Print.Library if (thisTab != "") { thisTab = thisTab.Trim(" ".ToCharArray()); - //if (hasDelim && !thisTab.EndsWith(".") && !thisTab.EndsWith(")")) thisTab = thisTab + "."; if (!thisTab.EndsWith(".") && !thisTab.EndsWith(")")) thisTab = thisTab + "."; } else thisTab = "{" + typeName + " " + pitem.Ordinal.ToString() + "}."; - //sret = "." + thisTab + sret; sret = thisTab + sret; } pitem = pitem.ActiveParent as ItemInfo; @@ -964,16 +788,13 @@ namespace Volian.Print.Library StepInfo stpinfo = StepInfo.Get(pitem.ItemID); string hlsTab = stpinfo.MyTab.CleanTextNoSymbols; //StepInfo.Get(pitem.ItemID).MyTab.CleanTextNoSymbols; - //string thisTab = stpinfo.MyTab.CleanText; //StepInfo.Get(pitem.ItemID).MyTab.CleanText; string typeName = stpinfo.FormatStepData.StepEditData.TypeMenu.MenuItem;//stpinfo.FormatStepData.GetPDDisplayName(); //.ToString(); if (hlsTab == null || hlsTab == "") hlsTab = "{" + typeName + " " + pitem.Ordinal.ToString() + "}."; else if (!sret.StartsWith(hlsTab.Trim(" ".ToCharArray()))) { - //if (!hasDelim) foreach (string rmvDelim in DelimList) hlsTab = hlsTab.Replace(rmvDelim, ""); hlsTab = hlsTab.Trim(" ".ToCharArray()); - //if (hasDelim && !hlsTab.EndsWith(".") && !hlsTab.EndsWith(")")) hlsTab = hlsTab + "."; if (!hlsTab.EndsWith(".") && !hlsTab.EndsWith(")")) hlsTab = hlsTab + "."; } sret = hlsTab + sret; @@ -1024,7 +845,6 @@ namespace Volian.Print.Library AddCell(colHeader, "Text", f2, subHeaderColor); datatable.AddCell(colHeader); datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT; - //string lastPath = ""; Color AnnoColor = new Color(0xFF, 0xFF, 0xC0); Color TextColor = Color.WHITE; Color SectColor = new Color(0xE0, 0xFF, 0xE0);//new Color(0xC0, 0xFF, 0xC0);//Color.LIGHT_GRAY; @@ -1190,7 +1010,6 @@ namespace Volian.Print.Library iTextSharp.text.Font f3 = pdf.GetFont("Arial Unicode MS", 12, 0, Color.BLACK); PdfPCell cell = new PdfPCell(new Phrase(ReportTitle, f1)); cell.HorizontalAlignment = Element.ALIGN_CENTER; - //cell.Colspan = 2; cell.BackgroundColor = new Color(0xD0, 0xF0, 0xF0); // light blue datatable.AddCell(cell); @@ -1266,8 +1085,6 @@ namespace Volian.Print.Library } private System.Collections.ArrayList GetSortedItemInfoList(ItemInfoList orgIFL) { - //ICollection rtnIFL; - //get list of different procedure sets System.Collections.ArrayList libDocProcSetList = new System.Collections.ArrayList(); System.Collections.ArrayList rtnIFL = new System.Collections.ArrayList(); foreach (ItemInfo item in orgIFL) @@ -1288,18 +1105,14 @@ namespace Volian.Print.Library private void BuildCompleteROReport(iTextSharp.text.Document document) { - iTextSharp.text.Font f1 = pdf.GetFont("Arial Unicode MS", 14, 1, Color.BLACK); - iTextSharp.text.Font f2 = pdf.GetFont("Arial Unicode MS", 10, 0, Color.BLACK); - iTextSharp.text.Font f3 = pdf.GetFont("Arial Unicode MS", 12, 0, Color.BLACK); - - iTextSharp.text.Font fntBold = new Font(f3.BaseFont, f3.Size, Font.BOLD, Color.RED); - CompleteROReport compRORpt = new CompleteROReport(document, _RODataFile); + CompleteROReport compRORpt = new CompleteROReport(_MyPdfWriter, document,_RODataFile, _ConvertCaretToDelta, _IncludeEmptyROFields); + compRORpt.F10 = pdf.GetFont("Courier New", 10, 0, Color.BLACK); + compRORpt.F10Bold = pdf.GetFont("Courier New", 10, 1, Color.BLACK); + compRORpt.F12 = pdf.GetFont("Courier New", 12, 0, Color.BLACK); + compRORpt.F12Bold = pdf.GetFont("Courier New", 12, 1, Color.BLACK); + compRORpt.F14 = pdf.GetFont("Arial Unicode MS", 14, 1, Color.BLACK); + compRORpt.ROFstID = _ROFSTLookup.MyDocVersionInfo.DocVersionAssociations[0].MyROFst.ROFstID; compRORpt.Run(); - - Phrase phrs = BuildPhrase2("Complete Referenced Objects Report", f1, fntBold); - Paragraph prgh = new Paragraph(phrs);//("Complete", fntBold); - //document.Add(prgh); - document.Add(phrs); } private string GetROTitleAndGroupsForSummary(ListroTitleList, List prevROTitleList) { @@ -1333,7 +1146,7 @@ namespace Volian.Print.Library cell.FollowingIndent = 72; cell.Colspan = 2; cell.BorderColor = Color.WHITE; - cell.BackgroundColor = Color.WHITE;//bgColor; + cell.BackgroundColor = Color.WHITE; cell.BorderWidthTop = 1; datatable.AddCell(cell); } @@ -1346,7 +1159,6 @@ namespace Volian.Print.Library cell.BorderColor = Color.WHITE; cell.Colspan = 2; cell.BackgroundColor = bgColor; - //cell.BorderWidthTop = 1; datatable.AddCell(cell); return; } @@ -1355,9 +1167,6 @@ namespace Volian.Print.Library { float[] headerwidths = { 10, 20, 80 }; PdfPTable datatable = new PdfPTable(1); - PdfPTable colHeader = new PdfPTable(headerwidths); - PdfPTable databaseTitle = new PdfPTable(1); - //datatable.FooterRows = 1; datatable.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin; datatable.LockedWidth = true; iTextSharp.text.Font f1 = pdf.GetFont("Arial Unicode MS", 14, 1, Color.BLACK);