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:
parent
d7643f4721
commit
985d7ae384
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -3274,15 +3274,23 @@ namespace Volian.Print.Library
|
||||
ROFSTLookup lookup = rofst.GetROFSTLookup(dvi);
|
||||
string linkInfoText = itemInfo.MyContent.Text.Replace(@"\v ", "");
|
||||
Match m = Regex.Match(linkInfoText, @"(.*)[#]Link:([A-Za-z]*):(.*)");
|
||||
string val = null;
|
||||
if (m.Groups.Count < 4)
|
||||
{
|
||||
erMsg = "RO was not found during data migration.";
|
||||
//erMsg = "RO was not found during data migration.";
|
||||
// added newlines in the RO number (shown in figure substep type with figure RO)
|
||||
// if we are here, then there is no RO link information, use this number to find the RO image to print
|
||||
val = string.Format("{0}\n{1}\n{2}\n{3}",
|
||||
linkInfoText.Substring(0, linkInfoText.Length - 16),
|
||||
linkInfoText.Substring(linkInfoText.Length - 16, 8),
|
||||
linkInfoText.Substring(linkInfoText.Length - 8, 4),
|
||||
linkInfoText.Substring(linkInfoText.Length - 4, 4));
|
||||
val = val.Replace(@"\u8209?", "-");
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] subs = m.Groups[3].Value.Split(" ".ToCharArray());
|
||||
string roid = subs[1];
|
||||
string val = lookup.GetRoValue(subs[1]);
|
||||
val = lookup.GetRoValue(subs[1]);
|
||||
if (val == null || val == "?") val = lookup.GetRoValue(subs[1].Substring(0, 12));
|
||||
if (val == "?")
|
||||
{
|
||||
@ -3290,7 +3298,9 @@ namespace Volian.Print.Library
|
||||
_MyLog.WarnFormat("\r\nMissing Referenced Object {0} in {1}", subs[1], itemInfo.ShortPath);
|
||||
yoff += 2 * SixLinesPerInch;
|
||||
}
|
||||
else if (val != null && val != "?")
|
||||
}
|
||||
GC.Collect(); // memory garbage collection (Regex memory bug)
|
||||
if (val != null && val != "?")
|
||||
{
|
||||
string[] vals = val.Split("\n".ToCharArray());
|
||||
Width = Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) * MyItemInfo.FormatStepData.Font.CharsToTwips;
|
||||
@ -3300,10 +3310,10 @@ namespace Volian.Print.Library
|
||||
// for between HLS & figure.
|
||||
float h1 = lines * SixLinesPerInch;
|
||||
float h2 = RoughSizeOfPage - MyParent.Height - SixLinesPerInch;
|
||||
Height = Math.Min(h1,h2);
|
||||
Height = Math.Min(h1, h2);
|
||||
if (h1 > h2)
|
||||
{
|
||||
Width *= (h2/h1);
|
||||
Width *= (h2 / h1);
|
||||
}
|
||||
//yForCheckoff = yoff + Height - SixLinesPerInch;
|
||||
yoff = AdjustLocIfLongerRNO(itemInfo, yoff, yoffRightParent);
|
||||
@ -3319,7 +3329,7 @@ namespace Volian.Print.Library
|
||||
ImageText = val;
|
||||
else
|
||||
{
|
||||
roImage = rofst.GetROImageByFilename(vals[0],MyItemInfo);// need code to go and get an ROImaage if it exists
|
||||
roImage = rofst.GetROImageByFilename(vals[0], MyItemInfo);// need code to go and get an ROImaage if it exists
|
||||
if (roImage == null)
|
||||
erMsg = string.Format("Image {0} does not exist.", vals[0]);
|
||||
else
|
||||
@ -3332,7 +3342,6 @@ namespace Volian.Print.Library
|
||||
erMsg = string.Format("Image {0} does not exist, error = {1}.", vals[0], ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (erMsg != null) Rtf = GetRtf(erMsg, itemInfo.ActiveFormat.PlantFormat.FormatData.Font);
|
||||
CalculateXOffsetGridOrFigure(itemInfo, maxRNO, formatInfo);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user