Print Library, Svg Library, Utils Library, XYPlots

This commit is contained in:
2026-07-24 13:36:46 -04:00
parent 06c3136566
commit f67d37801a
68 changed files with 12173 additions and 16618 deletions
+12 -61
View File
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using LBWordLibrary;
using VEPROMS.CSLA.Library;
using System.Text.RegularExpressions;
@@ -10,12 +7,12 @@ namespace Volian.Print.Library
{
public class Placekeeper : IDisposable
{
private LBApplicationClass _WordApp;
private LBDocumentClass _WordDoc;
private LBSelection _WordSel;
private readonly LBApplicationClass _WordApp;
private readonly LBDocumentClass _WordDoc;
private readonly LBSelection _WordSel;
private LBTable _WordTbl;
private const string TheQuickBrownFox = "The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.";
private VE_Font _pkFont;
private readonly VE_Font _pkFont;
public Placekeeper()
{
_WordApp = new LBApplicationClass();
@@ -28,37 +25,11 @@ namespace Volian.Print.Library
_WordApp.Visible = true;
_WordApp.Activate();
}
//public Placekeeper(pkParagraph myPlacekeeper)
//{
// _WordApp = new LBApplicationClass();
// _WordDoc = _WordApp.Documents.Add();
// _WordSel = _WordApp.Selection;
// _WordApp.Visible = true;
// AddTable();
// AddHeader();
// AddSectionHeader(myPlacekeeper.MyParagraph.MyItemInfo.DisplayNumber, myPlacekeeper.MyParagraph.MyItemInfo.DisplayText);
// foreach (pkParagraph pgh in myPlacekeeper.MyChildren)
// {
// AddHighLevelStep(pgh.MyParagraph.MyItemInfo.MyTab.CleanText, pgh.MyParagraph.MyItemInfo.DisplayText, pgh.MyParagraph.MyItemInfo.FormatStepType==9 ? "C" : "", pgh.MyParagraph.MyItemInfo.PageNumber.ToString());
// if (pgh.MyChildren.Count > 0)
// {
// StartSubStep();
// foreach (pkParagraph cpgh in pgh.MyChildren)
// {
// ContinueSubStep(cpgh.MyParagraph.MyItemInfo.DisplayText, 1);
// foreach (pkParagraph ccpgh in cpgh.MyChildren)
// ContinueSubStep(ccpgh.MyParagraph.MyItemInfo.DisplayText, 2);
// }
// FinishSubstep("", "");
// }
// }
//}
public Placekeeper(pkParagraphs myPlacekeepers, VE_Font pkFont)
{
_WordApp = new LBApplicationClass();
_WordDoc = _WordApp.Documents.Add();
_WordSel = _WordApp.Selection;
//_WordApp.Visible = true;
_pkFont = pkFont;
AddTable();
AddHeader();
@@ -97,7 +68,7 @@ namespace Volian.Print.Library
if (cpgh.MyCautionsAndNotes.Count > 0)
AddNotesOrCautions(cpgh,level, ref conAct);
if (!conAct)
conAct = IsContinuousActionPlacekeeper(conAct, cpgh);
conAct = IsContinuousActionPlacekeeper(cpgh);
ContinueSubStep(cpgh.MyParagraph.MyItemInfo.FormattedDisplayText, level);
AddChildren(cpgh, level+1, ref conAct);
}
@@ -108,19 +79,14 @@ namespace Volian.Print.Library
foreach (pkParagraph cpgh in pgh.MyCautionsAndNotes)
{
if (!conAct)
conAct = IsContinuousActionPlacekeeper(conAct, cpgh);
conAct = IsContinuousActionPlacekeeper(cpgh);
ContinueNoteOrCaution(cpgh.MyParagraph.MyItemInfo, level);
}
}
private static bool IsContinuousActionPlacekeeper(bool conAct, pkParagraph pkPar)
{
StepConfig sc = pkPar.MyParagraph.MyItemInfo.MyConfig as StepConfig;
conAct = (sc.Step_Placekeeper.ToUpper() == "C");
return conAct;
}
private static bool IsContinuousActionPlacekeeper(pkParagraph pkPar) => (pkPar.MyParagraph.MyItemInfo.MyConfig as StepConfig).Step_Placekeeper.ToUpper() == "C";
private void ContinueNoteOrCaution(ItemInfo ii, int level)
private void ContinueNoteOrCaution(ItemInfo ii, int level)
{
string NoteCautionTab = "NOTE: ";
if (ii.IsCaution) NoteCautionTab = "CAUTION: ";
@@ -176,22 +142,17 @@ namespace Volian.Print.Library
_WordTbl.TopPadding = 6F;
_WordTbl.BottomPadding = 6F;
LBColumn col = _WordTbl.Columns.First;
//col.SetWidth(12F, LBWdRulerStyle.wdAdjustNone);
//col = col.Next;
col.SetWidth(72 * .91F, LBWdRulerStyle.wdAdjustNone);
col = col.Next;
col.SetWidth(72 * 4.1F, LBWdRulerStyle.wdAdjustNone);
col = col.Next;
//col.SetWidth(72 * .81F, LBWdRulerStyle.wdAdjustNone);
col.SetWidth(72 * .76F, LBWdRulerStyle.wdAdjustNone);
col = col.Next;
//col.SetWidth(72 * .81F, LBWdRulerStyle.wdAdjustNone);
col.SetWidth(72 * .76F, LBWdRulerStyle.wdAdjustNone);
_WordTbl.Rows.AllowBreakAcrossPages = 0;
}
private void AddHeader()
{
//Advance();
WriteCell("START", true, true);
SetIndent(0.32F, -0F);
WriteCell("FUNCTION", true, true);
@@ -219,7 +180,6 @@ namespace Volian.Print.Library
// follow through in fixing an Out of Window Handles bug, use new function to see if
// we can retrieve the font from a dictionary instead a doing a New and using another
// window handle B2017-117
//System.Drawing.Font font = new System.Drawing.Font(_pkFont.Family, (float)_pkFont.Size);
System.Drawing.Font font = VE_Font.GetWinSysFont(_pkFont.Family, (float)_pkFont.Size);
iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font);
float w = 0;
@@ -227,8 +187,6 @@ namespace Volian.Print.Library
{
w += iFont.BaseFont.GetWidthPointKerned(c.ToString(), (float)_pkFont.Size);
}
// indented text didn't always line up doing it this way
//float w = iFont.BaseFont.GetWidthPointKerned(txt, (float)_pkFont.Size);
return w;
}
private void AddHighLevelStep(string number, string text, string done, string page)
@@ -276,7 +234,6 @@ namespace Volian.Print.Library
{
Advance(2);
SetIndent(.64F, -.31F);
//_WordSel.InsertSymbol(8226, _WordSel.Font, System.Reflection.Missing.Value, System.Reflection.Missing.Value);
WriteCell("\u2022" + "\t" + text, false, true);
SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom);
WriteCell(done, false, true);
@@ -316,7 +273,7 @@ namespace Volian.Print.Library
SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom);
WriteCell(page, false, false);
}
static Regex rgx = new Regex(@"\\(b|ul|up[1-9]|dn0|up0|dn[1-9]|b0|ulnone)( |$|(?=\\))");
static readonly Regex rgx = new Regex(@"\\(b|ul|up[1-9]|dn0|up0|dn[1-9]|b0|ulnone)( |$|(?=\\))");
private void WriteRTF(string text)
{
//if (text.Contains("\\"))
@@ -381,13 +338,7 @@ namespace Volian.Print.Library
{
_WordSel.MoveRight(LBWdUnits.wdCell, count, false);
}
private void Advance()
{
Advance(1);
}
public void Dispose()
{
_WordApp.Quit(false);
}
}
private void Advance() => Advance(1);
public void Dispose() => _WordApp.Quit(false);
}
}