removed a console.writeline

Control to create RO Usage, RO Summary, RO Complete, and Transition Usage reports
Logic to print RO Usage reports
Ifdef’d logic for UseOnFirstPage
logic for Width Override and Ifdef’d logic for UseOnFirstPage
Beginings of code to generate a Complete RO Report
This commit is contained in:
2012-09-13 19:58:05 +00:00
parent 80e72fbbb0
commit 04fac124c1
9 changed files with 3399 additions and 9 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -18,7 +18,9 @@ namespace Volian.Print.Library
SearchResults = 0,
LibraryDocUsage = 1,
ReferencedObjectsUsage = 2,
TransitionUsage = 3
TransitionUsage = 3,
ReferencedObjectSummary = 4,
ReferencedObjectComplete =5
}
private ICollection<ItemInfo> _ResultList;
@@ -66,7 +68,10 @@ namespace Volian.Print.Library
}
private int _ReportType = 0;
private string _ByLine;
private bool _SortUsageByProcedure = false;
private string _RODataFile = "";
// Search Results Report
public PDFReport(string reportTitle, string typesSelected, ICollection<ItemInfo> resultList, string fileName)
{
_ResultList = resultList;
@@ -77,6 +82,8 @@ namespace Volian.Print.Library
_ByLine = "PROMS Search Results";
}
// Library Document Report
public PDFReport(string reportTitle, DocumentInfoList libDocList, string fileName)
{
_LibDocList = libDocList;
@@ -85,6 +92,28 @@ namespace Volian.Print.Library
_ReportType = (int)ReportType.LibraryDocUsage;
_ByLine = "Generated By PROMS";
}
// Transition and RO Usage
public PDFReport(string reportTitle, ICollection<ItemInfo> resultList, string fileName, bool sortUsageByProcedure)
{
_ResultList = resultList;
_FileName = fileName;
_ReportTitle = VEPROMS.CSLA.Library.ItemInfo.ConvertToDisplayText(reportTitle);
_ReportType = (int)ReportType.ReferencedObjectsUsage;
_ByLine = "Generated By PROMS";
_SortUsageByProcedure = sortUsageByProcedure;
}
// RO Coomplete and Summary Reports
public PDFReport(string reportTitle, string roDataFile, string outfile, bool completeReport)
{
_FileName = outfile;
_ReportTitle = reportTitle;
_ReportType = (completeReport) ? (int)ReportType.ReferencedObjectComplete : (int)ReportType.ReferencedObjectSummary;
_ByLine = (completeReport) ? "Complete RO Report" : "Summary RO Report";
_RODataFile = roDataFile;
}
//public void Build2()
//{
// iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LETTER, 36, 36, 36, 36);
@@ -207,7 +236,7 @@ namespace Volian.Print.Library
{
retval = NewPath[--n];
if (retval.Contains("\x11"))
retval = retval.Substring(0, retval.IndexOf("\x11"));
retval = retval.Substring(0, retval.IndexOf("\x11")); // this is the step number
}
for (int j = jstart; j < n; j++)
{
@@ -229,11 +258,62 @@ namespace Volian.Print.Library
}
return retval;
}
private void AddProcedureSectionGroup(PdfPTable datatable, string curProc, string lastProc, string curSect, string lastSect, Font f2, Color bgColor)
{
string headerText = "";
if (curProc != lastProc)
headerText = curProc + "\r\n";
if (curSect != lastSect)
headerText += " " + curSect;
if (headerText.Length > 0)
{
headerText = headerText.Replace(@"\u8209?", "-");// repace unicode with dash char
headerText = headerText.Replace(@"\u160?", " "); // replace Hard Space with normal Space
PdfPCell cell = new PdfPCell(new Phrase(headerText, f2));
cell.Colspan = 2;
cell.BackgroundColor = bgColor;
cell.BorderWidthTop = 1;
datatable.AddCell(cell);
}
}
private string GetCurProcNum(string path)
{
string[] NewPath = path.Split("\x7".ToCharArray());
return NewPath[1];
}
//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 = "";
rtnstr = itm.ActiveSection.DisplayNumber;
if (rtnstr.Length > 0) rtnstr += " ";
rtnstr += itm.ActiveSection.DisplayText;
return rtnstr; // srting containing section and subsection number/titles
}
//private string GetStepNumberFromSearchPath(string path)
//{
// string[] NewPath = path.Split("\x7".ToCharArray());
// int idx = NewPath.Length - 1;
// string retval = NewPath[idx];
// if (retval.Contains("\x11"))
// retval = retval.Substring(0, retval.IndexOf("\x11")); // this is the step number
// return retval;
//}
private int FindSpitLevel()
{
int level = 0;
@@ -326,6 +406,15 @@ namespace Volian.Print.Library
case (int)ReportType.LibraryDocUsage:
BuildLibDocUsageReport(document);
break;
case (int)ReportType.ReferencedObjectsUsage:
if (_SortUsageByProcedure)
BuildROUsageTableByProcedure(document);
else
BuildROUsageTableByRO(document);
break;
case (int)ReportType.ReferencedObjectComplete:
BuildCompleteROReport(document);
break;
}
}
catch (Exception ex)
@@ -681,7 +770,398 @@ namespace Volian.Print.Library
}
document.Add(datatable);
}
private System.Collections.ArrayList ProcSetList;
private void AddROUsages(ItemInfo item, Dictionary<string,List<ItemInfo>> roUse)
{
//string lastROid = "";
if (item.FoundROID != null && item.FoundROID != "")
{
string roid = item.FoundROID;
if (roUse.ContainsKey(roid))
((List<ItemInfo>)roUse[roid]).Add(item);
else
{
List<ItemInfo> itmIfoLst = new List<ItemInfo>();
itmIfoLst.Add(item);
roUse.Add(roid, itmIfoLst);
}
}
}
private void PutROusageForProcedure(PdfPTable curTable, Dictionary<string, List<ItemInfo>> rosused, float[] headerwidths)
{
//if (rosused.Count == 0) return; // nothing to process
iTextSharp.text.Font f2 = pdf.GetFont("Arial Unicode MS", 10, 0, Color.BLACK);
foreach (string roKey in rosused.Keys)
{
PdfPTable rotable = new PdfPTable(headerwidths);
string rotitle = "";
foreach (ItemInfo itm in rosused[roKey])
{
if (rotitle == "")
{
//ROFSTLookup myrofstlookup = itm.MyDocVersion.DocVersionAssociations[0].MyROFst.ROFSTLookup;
//List<string> 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);
PdfPCell ROTitleCell = new PdfPCell(new Phrase(rotitle, f2));
ROTitleCell.Colspan = 2;
ROTitleCell.HorizontalAlignment = Element.ALIGN_LEFT;
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
}
string stepnum = "";
string sectitle = itm.ActiveSection.DisplayText;
if (itm.IsSection)
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);
}
curTable.AddCell(rotable);
}
}
private static string BuildStepTab(ItemInfo item)
{
if (item == null) return "";
string sret = "";
switch (item.MyContent.Type / 10000)
{
case 0: //procedure
sret = ProcedureInfo.Get(item.ItemID).MyTab.CleanText;
break;
case 1: // section
sret = SectionInfo.Get(item.ItemID).MyTab.CleanText;
break;
case 2: // step
ItemInfo pitem = item;
bool hasDelim = item.ActiveFormat.PlantFormat.FormatData.TransData.StepSubstepDelimeter != null;
List<string> DelimList = null;
if (!hasDelim)
{
DelimList = new List<string>();
SeqTabFmtList seqtabs = item.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.SeqTabFmtList;
foreach (SeqTabFmt seqtab in seqtabs)
{
string delim = seqtab.PrintTabFormat.Replace("{seq}", "");
DelimList.Add(delim.Trim());
}
}
while (!pitem.IsHigh)
{
StepInfo stpinfo = StepInfo.Get(pitem.ItemID);
string thisTab = stpinfo.MyTab.CleanText; //StepInfo.Get(pitem.ItemID).MyTab.CleanText;
string typeName = stpinfo.FormatStepData.StepEditData.TypeMenu.MenuItem;//stpinfo.FormatStepData.ToString();
// remove delimiters of '.' and ')' in tab.
if (thisTab != null && !hasDelim)
{
// get list of delimiters to remove from the format:
foreach (string rmvDelim in DelimList) thisTab = thisTab.Replace(rmvDelim, "");
}
if (thisTab != null) thisTab = thisTab.Trim();
// if the tab is null or
// if the the tab is not a letter or number OR
// the tab is an AND or OR type and is the letter "o"
// then reset the tab an empty string so that the type name along with the count of that type
// (ex. "AND 2", "OR 3")
if (thisTab == null || (thisTab != "" && (!(char.IsLetterOrDigit(thisTab[0])) || ((pitem.IsAnd || pitem.IsOr) && thisTab.Contains("o")))))
thisTab = "";
if (pitem.IsRNOPart)
{
if (thisTab == "")
sret = " RNO" + sret; //"RNO." + sret;
else
{
thisTab = thisTab.Trim(" ".ToCharArray());
sret = " RNO." + thisTab + sret; //"RNO." + thisTab + sret;
}
}
else if (pitem.IsCaution || pitem.IsNote)
{
// add the Caution or Note count to the tab (ex "Caution 1", "Note 2")
if (thisTab == "")
sret = ".{" + typeName + " " + pitem.Ordinal.ToString() + "}";
else
{
thisTab = thisTab.Trim(" ".ToCharArray());
sret = "." + thisTab + " " + pitem.Ordinal.ToString() + sret;
}
}
else
{
if (thisTab != "")
{
thisTab = thisTab.Trim(" ".ToCharArray());
if (hasDelim && !thisTab.EndsWith(".") && !thisTab.EndsWith(")")) thisTab = thisTab + ".";
}
else
thisTab = "{" + typeName + " " + pitem.Ordinal.ToString() + "}";
sret = "." + thisTab + sret;
}
pitem = pitem.ActiveParent as ItemInfo;
if (pitem == null) break;
}
// add hls tab if it's not already in the tab.
if (pitem.IsHigh)
{
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 + ".";
}
sret = hlsTab + sret;
}
break;
}
sret = sret.Trim(" .)".ToCharArray());
return sret;
}
private void BuildROUsageTableByProcedure(iTextSharp.text.Document document)
{
Dictionary<string, List<ItemInfo>> roUse = new Dictionary<string, List<ItemInfo>>();
float[] headerwidths = { 20, 80 };
PdfPTable datatable = new PdfPTable(1);
PdfPTable colHeader = new PdfPTable(headerwidths);
//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);
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);
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);
BuildSearchResultsProcSetList();
datatable.HeaderRows = 2;//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
Color subHeaderColor = new Color(0xD0, 0xF0, 0xF0); // light blue //new Color(0xD0, 0xF0, 0xD0);//ligt green
datatable.DefaultCell.Padding = 4;
datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
// This puts "Step" and "Text" column headers at the bottom of the page
AddCell(colHeader, "Step", f2, subHeaderColor);
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;
PdfPTable subTable = new PdfPTable(headerwidths);
datatable.AddCell(subTable);
string lastProcNum = "";
string lastSection = "";
string lastDVPath = "";
foreach (ItemInfo item in _ResultList)
{
// Check Doc Version path
if (lastDVPath != item.SearchDVPath)
{
subTable = new PdfPTable(headerwidths);
AddMainPathGroup(datatable, item.SearchDVPath, splitAt, f2, Color.LIGHT_GRAY, 0);
lastProcNum = "";
lastSection = "";
}
lastDVPath = item.SearchDVPath;
//check for different procedure number
string curProcNum = GetCurProcNum(item.SearchPath);
string curSection = GetCurSectionNumTitle(item);
if (lastProcNum != "" && (curProcNum != lastProcNum))
{
if (roUse.Count > 0)
{
PutROusageForProcedure(datatable, roUse, headerwidths);
roUse.Clear();
}
lastSection = "";
}
if (lastSection != "" && (curSection != lastSection))
{
if (roUse.Count > 0)
{
PutROusageForProcedure(datatable, roUse, headerwidths);
roUse.Clear();
}
}
AddROUsages(item, roUse); // add the used ro to the list for this procedure
AddProcedureSectionGroup(datatable, curProcNum, lastProcNum, curSection, lastSection, f2, new Color(0xC0, 0xFF, 0xC0));
lastProcNum = curProcNum;
lastSection = curSection;
}
PutROusageForProcedure(datatable, roUse, headerwidths);
document.Add(datatable);
}
private void AddProcROUse(ItemInfo item, Dictionary<string, List<ItemInfo>> procRoUse)
{
string dictKey = GetCurProcNum(item.SearchPath) + " " + GetCurSectionNumTitle(item);
if (dictKey != null && dictKey != "")
{
if (procRoUse.ContainsKey(dictKey))
((List<ItemInfo>)procRoUse[dictKey]).Add(item);
else
{
List<ItemInfo> itmIfoLst = new List<ItemInfo>();
itmIfoLst.Add(item);
procRoUse.Add(dictKey, itmIfoLst);
}
}
}
private void PutROusageForROID(PdfPTable curTable, Dictionary<string, List<ItemInfo>> procRoUse, float[] headerwidths)
{
//if (rosused.Count == 0) return; // nothing to process
iTextSharp.text.Font f2 = pdf.GetFont("Arial Unicode MS", 10, 0, Color.BLACK);
string lastProcKey = "";
foreach (string procKey in procRoUse.Keys)
{
PdfPTable rotable = new PdfPTable(headerwidths);
foreach (ItemInfo itm in procRoUse[procKey])
{
if (procKey != lastProcKey)
{
string procNumTitleSect = GetCurProcNum(itm.SearchPath) + "\r\n " + GetCurSectionNumTitle(itm);
procNumTitleSect = procNumTitleSect.Replace(@"\u8209?", "-"); // repace unicode with dash char
procNumTitleSect = procNumTitleSect.Replace(@"\u160?", " "); // replace Hard Space with normal Space
PdfPCell ProcTitleCell = new PdfPCell(new Phrase(procNumTitleSect, f2));
ProcTitleCell.Colspan = 2;
ProcTitleCell.HorizontalAlignment = Element.ALIGN_LEFT;
ProcTitleCell.BackgroundColor = new Color(0xDC, 0xE7, 0xC9); //new Color(0xD0, 0xF0, 0xD0);//ligt green //new Color(0xC8, 0xC8, 0x91);//(0xAF, 0xD8, 0xD8);//(0xF5, 0xE4, 0xA0);
rotable.AddCell(ProcTitleCell); // put RO value and description
lastProcKey = procKey;
}
string stepnum = "";
string sectitle = itm.ActiveSection.DisplayText;
if (itm.IsSection)
stepnum = itm.MyActiveSection.DisplayNumber;
else
stepnum = BuildStepTab(itm);//GetStepNumberFromSearchPath(itm.SearchPath);//stepnum.Substring(itm.SearchPath.LastIndexOf(sectitle) + sectitle.Length +1);
AddCell(rotable, stepnum, f2, Color.WHITE);
AddCell(rotable, itm.DisplayText, f2, Color.WHITE);
}
curTable.AddCell(rotable);
}
}
private static string GetROTitleAndGroup(string roid, ItemInfo itm)
{
string rotitle = "";
ROFSTLookup myrofstlookup = itm.MyDocVersion.DocVersionAssociations[0].MyROFst.ROFSTLookup;
List<string> roTitleList = myrofstlookup.GetROTitleAndGroupPath(roid);
for (int cnt = 0; cnt < roTitleList.Count; cnt++)
{
if (cnt == roTitleList.Count - 1)
rotitle += roTitleList[cnt];
else
rotitle += roTitleList[cnt] + "\n ";
}
return rotitle;
}
private void AddROHeaderGroup(PdfPTable datatable, string curROID, ItemInfo itm, Font f2, Color bgColor)
{
string headerText = GetROTitleAndGroup(curROID, itm);
if (headerText.Length > 0)
{
PdfPCell cell = new PdfPCell(new Phrase(headerText, f2));
cell.Colspan = 2;
cell.BackgroundColor = bgColor;
cell.BorderWidthTop = 1;
datatable.AddCell(cell);
}
}
private void BuildROUsageTableByRO(iTextSharp.text.Document document)
{
Dictionary<string, List<ItemInfo>> procRoUse = new Dictionary<string, List<ItemInfo>>();
float[] headerwidths = { 20, 80 };
PdfPTable datatable = new PdfPTable(1);
PdfPTable colHeader = new PdfPTable(headerwidths);
//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);
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);
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);
BuildSearchResultsProcSetList();
datatable.HeaderRows = 2;//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
Color subHeaderColor = new Color(0xD0, 0xF0, 0xF0); // light blue //new Color(0xD0, 0xF0, 0xD0);//ligt green
datatable.DefaultCell.Padding = 4;
datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
// This puts "Step" and "Text" column headers at the bottom of the page
AddCell(colHeader, "Step", f2, subHeaderColor);
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;
PdfPTable subTable = new PdfPTable(headerwidths);
datatable.AddCell(subTable);
string lastDVPath = "";
string lastROID = "";
foreach (ItemInfo item in _ResultList)
{
// Check Doc Version path
if (lastDVPath != item.SearchDVPath)
{
subTable = new PdfPTable(headerwidths);
AddMainPathGroup(datatable, item.SearchDVPath, splitAt, f2, Color.LIGHT_GRAY, 0);
}
lastDVPath = item.SearchDVPath;
// Chec for different ROID
string curROID = item.FoundROID;
if (curROID != lastROID)
{
if (lastROID != "" && procRoUse.Count > 0)
{
PutROusageForROID(datatable, procRoUse, headerwidths);
procRoUse.Clear();
}
AddROHeaderGroup(datatable, curROID, item, f2, new Color(0xC0, 0xFF, 0xC0));
}
AddProcROUse(item, procRoUse);
lastROID = curROID;
}
PutROusageForROID(datatable, procRoUse, headerwidths);
document.Add(datatable);
}
private System.Collections.ArrayList ProcSetList;
private void BuildSearchResultsProcSetList()
{
ProcSetList = new System.Collections.ArrayList();
@@ -725,6 +1205,22 @@ namespace Volian.Print.Library
}
return rtnIFL;
}
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);
compRORpt.Run();
Phrase phrs = BuildPhrase2("Complete Referenced Objects Report", f1, fntBold);
Paragraph prgh = new Paragraph(phrs);//("Complete", fntBold);
//document.Add(prgh);
document.Add(phrs);
}
}
public class MyPageHelper : PdfPageEventHelper
{

View File

@@ -340,6 +340,20 @@ namespace Volian.Print.Library
{
if ((mySection.MyContent.Number.ToUpper() == "FOLDOUT") != doingFoldout) continue;
SectionConfig sc = mySection.MyConfig as SectionConfig;
#if AllButFirstPage
if (_MyHelper != null && mySection.IsStepSection && mySection.MyPrevious != null && mySection.MyPrevious.IsStepSection)
{
//SectionConfig.SectionPagination sPag = SectionConfig.SectionPagination.Separate;
//sPag = sc.Section_Pagination;
//if (sPag == SectionConfig.SectionPagination.Continuous)
if (sc.Section_Pagination == SectionConfig.SectionPagination.Continuous)
{
if (mySection.MyDocStyle.StructureStyle.Where == E_DocStyleUse.UseOnFirstPage)
mySection.DidFirstPageDocStyle = true;
}
}
#endif
PrintOverride.CompressSuper = mySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressHPSuper;
PrintOverride.CompressSub = mySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressHPSub;
OnStatusChanged((mySection.DisplayNumber ?? "") == "" ? mySection.DisplayText : mySection.DisplayNumber, PromsPrinterStatusType.Progress, progress++);
@@ -391,7 +405,7 @@ namespace Volian.Print.Library
PdfReader readerWord = null;
string myPdfFile = null;
_MyHelper.FinalMessageSectionID = finalMessageSectionID; // set VlnSvgPageHelper with the finalMessageSectionID
SectionConfig sc = mySection.MyConfig as SectionConfig;
//SectionConfig sc = mySection.MyConfig as SectionConfig;
if (mySection.IsAutoTOCSection)
GenerateTOC(mySection, myProcedure, cb, _TextLayer);
else
@@ -662,7 +676,10 @@ namespace Volian.Print.Library
private float _NoBreakYPageStart = 0;
private void CreateStepPdf(SectionInfo section, PdfContentByte cb)
{
//section.PageNumForDocStyle = 1; // first step of the section
//section.PageNumForDocStyle = 1;
#if AllButFirstPage
section.DidFirstPageDocStyle = false; // first step of the section
#endif
iTextSharp.text.pdf.PdfWriter writer = cb.PdfWriter;
ItemInfo myItemInfo = section as ItemInfo;
// 792: 72 * 11 inches - TopRow - Top is high value

View File

@@ -420,6 +420,20 @@ namespace Volian.Print.Library
}
private Volian.Svg.Library.Svg BuildSvg(VEPROMS.CSLA.Library.SectionInfo mySection)
{
// if mysection uses continuous pagination, and the previous section uses the same format,
// and the docstyle is set to use on first page only,
// then set section to use the Use On Rest of Pages
//SectionConfig.SectionPagination sPag = SectionConfig.SectionPagination.Separate;
//if (mySection.IsStepSection && mySection.MyPrevious != null && mySection.MyPrevious.IsStepSection)
//{
// SectionConfig sc = mySection.MyConfig as SectionConfig;
// sPag = sc.Section_Pagination;
// if (sPag == SectionConfig.SectionPagination.Continuous)
// {
// if (MySection.MyDocStyle.StructureStyle.Where == E_DocStyleUse.UseOnFirstPage)
// MySection.DidFirstPageDocStyle = true;
// }
//}
VEPROMS.CSLA.Library.FormatInfo activeFormat = mySection.ActiveFormat;
VEPROMS.CSLA.Library.DocStyle docStyle = mySection.MyDocStyle;
Volian.Svg.Library.Svg mySvg = null;
@@ -443,6 +457,7 @@ namespace Volian.Print.Library
SectionConfig sc = mySection.MyConfig as SectionConfig;
sPag = sc.Section_Pagination;
}
//if (sPag == SectionConfig.SectionPagination.Continuous && !mySection.DidFirstPageDocStyle) return null;
if (sPag == SectionConfig.SectionPagination.Continuous) return null;
return mySvg;
}
@@ -600,7 +615,10 @@ namespace Volian.Print.Library
foreach (VEPROMS.CSLA.Library.PageItem pageItem in pageStyle.PageItems)
{
VE_Font useFontForCheckOffHeader = null;
if (sPag == SectionConfig.SectionPagination.Separate || ((sPag == SectionConfig.SectionPagination.Continuous || sPag ==0 )&& pageItem.Row < 0))
#if AllButFirstPage
if (sPag == SectionConfig.SectionPagination.Separate || ((sPag == SectionConfig.SectionPagination.Continuous || sPag ==0 )&& ((pageItem.Row < 0) || section.DidFirstPageDocStyle)))
#endif
if (sPag == SectionConfig.SectionPagination.Separate || ((sPag == SectionConfig.SectionPagination.Continuous || sPag ==0 )&& (pageItem.Row < 0)))
{
//if (PrevRow > 0)
//{

View File

@@ -438,6 +438,10 @@ namespace Volian.Print.Library
}
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
{
#if AllButFirstPage
// 792: 72 * 11 inches - TopRow - Top is high value
float _PointsPerPage = 792;
#endif
if (IsWordDocPara)
{
PdfReader tmp = null;
@@ -454,6 +458,9 @@ namespace Volian.Print.Library
DebugText.WriteLine("ToPdf1:{0},'{1}',{2},{3},{4},{5}", MyItemInfo.ItemID, MyItemInfo.ShortSearchPath, XOffset, yLocation, yPageStart, YTopMost);
int paginate = Paginate(yLocation, yTopMargin, yBottomMargin);
bool firstHighLevelStep = MyItemInfo.IsHigh && (MyItemInfo.MyPrevious == null);
#if AllButFirstPage
SectionInfo currentSectionInfo = MyItemInfo.ActiveSection as SectionInfo;//MyItemInfo as SectionInfo;
#endif
switch (paginate)
{
case 0: // No page break
@@ -466,7 +473,19 @@ namespace Volian.Print.Library
break;
case 1: // Break on High Level Step
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
#if AllButFirstPage
// need logic for AllButFirstPage
// recac yTopMargin, YBottomMargin, YTopMost???
currentSectionInfo.DidFirstPageDocStyle = true;
//MyItemInfo.DidFirstPageDocStyle = true;
yTopMargin = _PointsPerPage - (float)currentSectionInfo.MyDocStyle.Layout.TopMargin; //(float)MyItemInfo.MyDocStyle.Layout.TopMargin;
yBottomMargin = Math.Max(0, yTopMargin - (float)currentSectionInfo.MyDocStyle.Layout.PageLength); //(float)MyItemInfo.MyDocStyle.Layout.PageLength);
#endif
cb.PdfDocument.NewPage();
#if AllButFirstPage
MyPageHelper.MySection = currentSectionInfo;
#endif
DebugText.WriteLine("Paginate1");
if (MyItemInfo.IsSection)
{
@@ -476,7 +495,6 @@ namespace Volian.Print.Library
// Only do foldout page if not done for section break, i.e. check the there's a previous step.
if (MyItemInfo.MyPrevious != null && (MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style ?? 0 & E_DocStructStyle.UseSectionFoldout) != 0)
PromsPrinter.DoFoldoutPage(cb, "HLS", MyPageHelper.TextLayer, MyPageHelper);
yPageStart = yTopMargin + YTopMost;
DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart);
MyPageHelper.YMultiplier = 1;
@@ -513,11 +531,22 @@ namespace Volian.Print.Library
}
MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Bottom.Margin ?? 0, msg_yLocation, docstyle.Continue.Bottom.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font);
}
#if AllButFirstPage
// need logic for AllButFirstPage
// recac yTopMargin, YBottomMargin, YTopMost???
//currentSectionInfo.DidFirstPageDocStyle = true;
currentSectionInfo.DidFirstPageDocStyle = true;
//MyItemInfo.DidFirstPageDocStyle = true;
yTopMargin = _PointsPerPage - (float)currentSectionInfo.MyDocStyle.Layout.TopMargin; //(float)MyItemInfo.MyDocStyle.Layout.TopMargin;
yBottomMargin = Math.Max(0, yTopMargin - (float)currentSectionInfo.MyDocStyle.Layout.PageLength); //(float)MyItemInfo.MyDocStyle.Layout.PageLength);
#endif
cb.PdfDocument.NewPage();
#if AllButFirstPage
MyPageHelper.MySection = currentSectionInfo;
#endif
DebugText.WriteLine("Paginate2");
if ((MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style ?? 0 & E_DocStructStyle.UseSectionFoldout) != 0)
PromsPrinter.DoFoldoutPage(cb, "Break within Step", MyPageHelper.TextLayer, MyPageHelper); // temporary foldout
// If there is a box, adjust the yTopMost to include it.
float yTopMost = YTopMost;
//if (YVeryTop < yTopMost) Console.WriteLine("{0},{1},{2}", MyItemInfo.DBSequence, yTopMost, YVeryTop);
@@ -539,7 +568,19 @@ namespace Volian.Print.Library
if (!firstHighLevelStep)
{
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
#if AllButFirstPage
// need logic for AllButFirstPage
// recac yTopMargin, YBottomMargin, YTopMost???
currentSectionInfo.DidFirstPageDocStyle = true;
//MyItemInfo.DidFirstPageDocStyle = true;
yTopMargin = _PointsPerPage - (float)currentSectionInfo.MyDocStyle.Layout.TopMargin; //(float)MyItemInfo.MyDocStyle.Layout.TopMargin;
yBottomMargin = Math.Max(0, yTopMargin - (float)currentSectionInfo.MyDocStyle.Layout.PageLength); //(float)MyItemInfo.MyDocStyle.Layout.PageLength);
#endif
cb.PdfDocument.NewPage(); // HLS (7 lpi) breakif (MyItemInfo.IsSection)
#if AllButFirstPage
MyPageHelper.MySection = currentSectionInfo;
#endif
DebugText.WriteLine("Paginate3");
if (MyItemInfo.IsSection)
{
@@ -1866,6 +1907,9 @@ namespace Volian.Print.Library
{
// NOT SURE IF WE NEED TO TEST FOR THE NULLBOX FORMAT FLAG, MAYBE "bx == null" IS THE SAME THING
//if (formatInfo.MyStepSectionLayoutData.NullBox)
if (widOvrd != 0)
Width = (float)widOvrd - tabWidth;
else
Width = (float)formatInfo.MyStepSectionLayoutData.WidT - tabWidth;
}
else