logic to save word sections with resolved RO values for exporting the approved procedure

logic to print an unlinked RO graphic(ex Tif) when used in a figure substep
This commit is contained in:
2016-02-18 15:32:19 +00:00
parent d7643f4721
commit 985d7ae384
2 changed files with 41 additions and 11 deletions

View File

@@ -87,6 +87,13 @@ namespace Volian.Print.Library
}
public class PromsPrinter
{
// used to save word sections with resolved ROs (for export file generated from approve)
private Dictionary<int, byte[]> _DocReplace;
public Dictionary<int, byte[]> DocReplace
{
get { return _DocReplace; }
set { _DocReplace = value; }
}
private bool _SaveLinks = false;
public bool SaveLinks
{
@@ -317,8 +324,11 @@ namespace Volian.Print.Library
DateTime tStart = DateTime.Now;
string MSWordFile = null;
if (section.MyContent.ContentEntryCount == 1)
{
{
MSWordToPDF.DocReplace = DocReplace;
MSWordFile = MSWordToPDF.GetDocPdf(section, PrintOverride.TextColor);
MSWordToPDF.DocReplace = null;
GC.Collect(); // memory garbage collection
OnStatusChanged("MSWord converted to PDF " + MSWordFile, PromsPrinterStatusType.MSWordToPDF);
}
return MSWordFile;
@@ -909,7 +919,7 @@ namespace Volian.Print.Library
int sectPageCount = 0;
float locEndOfWordDoc = 0;
float pdfSize = 0;
using (PdfInfo myPdf = PdfInfo.Get(mySection))
using (PdfInfo myPdf = PdfInfo.Get(mySection,false))
{
sectPageCount = (int)(Math.Ceiling(myPdf.PageCount));
locEndOfWordDoc = (float)(myPdf.PageCount - (sectPageCount - 1)) * 100;
@@ -1123,6 +1133,8 @@ namespace Volian.Print.Library
float secTitlePos = (float)tOfC.TofCSecTitlePos + xAdjTitle;
float secPagePos = (float)tOfC.TofCPageNumPos + xAdjNumber;
float height = tOfC.Font.WindowsFont.Size * 1.5F;
//bool didAttachmentGroupingTitle = false;
//string attachmentGroupHeading = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCAttGroupingHeader;
if (ii.Sections != null)
{
foreach (SectionInfo mySection in ii.Sections)
@@ -1131,6 +1143,14 @@ namespace Volian.Print.Library
if ((mySection.MyDocStyle != null && mySection.MyDocStyle.IncludeInTOC && (sc == null || sc.Section_TOC != "Y"))
|| ((mySection.MyDocStyle == null || !mySection.MyDocStyle.IncludeInTOC) && (sc != null && sc.Section_TOC == "Y")))
{
//if (!didAttachmentGroupingTitle && mySection.MyContent.Text.StartsWith("ATTACHMENT") && attachmentGroupHeading.Length > 0)
//{
// VE_Font grpingFont = new VE_Font(tOfC.Font.Family, (int)tOfC.Font.Size, (E_Style)tOfC.Font.Style | E_Style.Underline, (float)tOfC.Font.CPI);
// string rtfGrpingText = GetRtfToC(attachmentGroupHeading, tOfC, grpingFont);
// Paragraph myparagrapht = vlnPrintObject.RtfToParagraph(rtfGrpingText);
// width = secPagePos - adjSecTitlePos - 6;
// float retval = Rtf2Pdf.TextAt(cb, myparagrapht, leftMargin + ((tOfC.TofCSecNumPos == tOfC.TofCSecTitlePos && tmptxt.Equals(" ")) ? secNumPos : adjSecTitlePos), yPageStart - yLocation, width, height, "", yBottomMargin);
//}
// need to do the section number, section title & page number. Page number
// has to be put on at end after number of page is known, so use a Template.
string tmptxt = mySection.MyContent.Number == null || mySection.MyContent.Number == "" ? " " : mySection.MyContent.Number;
@@ -1752,7 +1772,8 @@ namespace Volian.Print.Library
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, ex.GetType().FullName, MessageBoxButtons.OK, MessageBoxIcon.Error);
if (_MyPromsPrinter.DocReplace == null)
MessageBox.Show(ex.Message, ex.GetType().FullName, MessageBoxButtons.OK, MessageBoxIcon.Error);
_MyLog.Warn(string.Format("Error in LoadSectionTree [{0}],{1}.{2}", si.ItemID, si.DisplayNumber, si.DisplayText), ex);
}
}