1395 lines
74 KiB
VB.net
1395 lines
74 KiB
VB.net
Imports MigraDoc.DocumentObjectModel
|
|
Imports MigraDoc.DocumentObjectModel.Shapes.Charts
|
|
Imports MigraDoc.DocumentObjectModel.Tables
|
|
Imports EgtBEAMWALL.Core
|
|
Imports EgtBEAMWALL.Core.ConstGen
|
|
Imports EgtUILib
|
|
Imports System.Collections.ObjectModel
|
|
Imports PdfSharp.Drawing
|
|
Imports MigraDoc.DocumentObjectModel.Shapes
|
|
Imports System.Windows.Forms.VisualStyles.VisualStyleElement.Header
|
|
|
|
Module PDFHelper
|
|
|
|
Friend Enum ListTypes As Integer
|
|
PART = 1
|
|
MACHGROUP = 2
|
|
RAWPART = 3
|
|
MACHGROUPTOT = 4
|
|
PART_LIST = 5
|
|
PART_TOT = 6
|
|
End Enum
|
|
|
|
Private m_TestText As String = "Testo di prova per testare MigraDoc nuget package"
|
|
Private m_TestMediumText As String = "Testo di prova MEDIO per testare MigraDoc nuget package"
|
|
Private m_TestShortText As String = "Testo di prova CORTO"
|
|
|
|
'Public Function CreateDocument() As Document
|
|
' ' creo nuovo documento MigraDoc
|
|
' Dim document As Document = New Document()
|
|
' document.Info.Title = "Hello, MigraDoc"
|
|
' document.Info.Subject = "Demonstrates an excerpt of the capabilities of MigraDoc."
|
|
' document.Info.Author = "Stefan Lange"
|
|
' DefineStyles(document)
|
|
' DefineCover(document)
|
|
' DefineTableOfContents(document)
|
|
' DefineContentSection(document)
|
|
' DefineParagraphs(document)
|
|
' DefineTables(document)
|
|
' DefineCharts(document)
|
|
' Return document
|
|
'End Function
|
|
|
|
Public Function CreateStatReport(ActivePage As Pages, bPreview As Boolean) As Document
|
|
' creo nuovo documento MigraDoc
|
|
Dim document As Document = New Document()
|
|
Dim Project As ProjectFileVM = ProjectManagerVM.CurrProd
|
|
'Select Case ActivePage
|
|
' Case Pages.VIEW
|
|
' Project = ProjectManagerVM.CurrProj
|
|
' document.Info.Title = Project.sProjId & " - " & Project.BTLFileName_Msg & " - Statistics"
|
|
' Case Pages.MACHINING
|
|
' Project = ProjectManagerVM.CurrProd
|
|
' document.Info.Title = Project.sProdId & " - " & Project.ListName_Msg & " - Statistics"
|
|
'End Select
|
|
|
|
If Pages.VIEW OrElse (Pages.ONLYPRODPAGE AndAlso Map.refInstrumentPanelVM.bVisOtt_Selected = False) Then
|
|
Project = ProjectManagerVM.CurrProj
|
|
document.Info.Title = Project.sProjId & " - " & Project.BTLFileName_Msg & " - Statistics"
|
|
ElseIf Pages.MACHINING OrElse (Pages.ONLYPRODPAGE AndAlso Map.refInstrumentPanelVM.bVisOtt_Selected) Then
|
|
Project = ProjectManagerVM.CurrProd
|
|
document.Info.Title = Project.sProdId & " - " & Project.ListName_Msg & " - Statistics"
|
|
End If
|
|
|
|
document.Info.Subject = "Production statistics of the project"
|
|
document.Info.Author = "EgtBEAMWALL"
|
|
DefineStyles(document)
|
|
'Select Case ActivePage
|
|
' Case Pages.VIEW
|
|
' DefinePartTotals(document)
|
|
' DefineItemList(document, ListTypes.PART)
|
|
' Case Pages.MACHINING
|
|
' DefineMachGroupTotals(document)
|
|
' DefineItemList(document, ListTypes.MACHGROUP)
|
|
' DefineItemList(document, ListTypes.RAWPART)
|
|
' If True Then
|
|
' DefineRawPartPictures(document)
|
|
' End If
|
|
'End Select
|
|
|
|
If ActivePage = Pages.VIEW OrElse (ActivePage = Pages.ONLYPRODPAGE AndAlso Map.refInstrumentPanelVM.bVisOtt_Selected = False) Then
|
|
DefinePartTotals(document)
|
|
DefineItemList(document, ListTypes.PART)
|
|
ElseIf ActivePage = Pages.MACHINING OrElse (ActivePage = Pages.ONLYPRODPAGE AndAlso Map.refInstrumentPanelVM.bVisOtt_Selected) Then
|
|
DefineMachGroupTotals(document)
|
|
DefineItemList(document, ListTypes.MACHGROUP)
|
|
DefineItemList(document, ListTypes.RAWPART)
|
|
If True Then
|
|
DefineRawPartPictures(document)
|
|
End If
|
|
End If
|
|
|
|
Return document
|
|
End Function
|
|
|
|
Public Sub DefinePartTotals(document As Document, section As Section, bPreview As Boolean)
|
|
Dim pgSetup As PageSetup = document.DefaultPageSetup.Clone()
|
|
pgSetup.Orientation = Orientation.Landscape
|
|
section.PageSetup = pgSetup
|
|
Dim paragraph As Paragraph = section.AddParagraph("Part Totals", "Heading2")
|
|
paragraph.Format.SpaceBefore = "3.0cm"
|
|
Dim sPartTot As ExpanderPDF = Map.refPDFEditorVM.ExpanderList.FirstOrDefault(Function(x) x.sNameCategory = EgtMsg(61734)) ' Recupero lista Part Totals
|
|
Dim sBTLTotParts As ExpanderElement = sPartTot.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61716)) ' Recupero Numero totale pezzi con relativo checkbox
|
|
Dim sBTLTotVolume As ExpanderElement = sPartTot.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61717)) ' Recupero Volume totale con relativo checkbox
|
|
Dim sBTLTotTime As ExpanderElement = sPartTot.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61718)) ' Recupero Tempo totale con relativo checkbox
|
|
Dim sBTLRemainingTime As ExpanderElement = sPartTot.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61720)) ' Recupero Tempo rimanente con relativo checkbox
|
|
If sBTLTotParts.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotParts_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sBTLTotParts, "127"))
|
|
If sBTLTotVolume.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotVolume_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sBTLTotVolume, "9.156"))
|
|
If sBTLTotTime.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotTime_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sBTLTotTime, "00:01:55"))
|
|
If sBTLRemainingTime.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLRemainingTime_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sBTLRemainingTime, "00:01:55"))
|
|
End Sub
|
|
|
|
Public Sub DefineMachGroupTotals(ByVal document As Document, section As Section, bPreview As Boolean)
|
|
'Dim section As Section = document.AddSection()
|
|
' cambio orientamento a orizzontale
|
|
Dim pgSetup As PageSetup = document.DefaultPageSetup.Clone()
|
|
pgSetup.Orientation = Orientation.Landscape
|
|
section.PageSetup = pgSetup
|
|
Dim paragraph As Paragraph = section.AddParagraph("Machgroup Totals", "Heading2")
|
|
paragraph.Format.SpaceBefore = "3.0cm"
|
|
Dim sMachGroup As ExpanderPDF = Map.refPDFEditorVM.ExpanderList.FirstOrDefault(Function(x) x.sNameCategory = EgtMsg(61729)) ' Recupero lista Machgroup Totals
|
|
Dim sNumberBlanks As ExpanderElement = sMachGroup.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61721)) ' Recupero Numero di grezzi con relativo checkbox
|
|
Dim sTotalVolume As ExpanderElement = sMachGroup.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61717)) ' Recupero Volume totale con relativo checkbox
|
|
Dim sEstimatedTotalTime As ExpanderElement = sMachGroup.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61719)) ' Recupero Tempo totale stimato con relativo checkbox
|
|
Dim sTotalTime As ExpanderElement = sMachGroup.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61718)) ' Recupero Tempo totale con relativo checkbox
|
|
Dim sRemainingTime As ExpanderElement = sMachGroup.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61720)) ' Recupero Tempo rimanente con relativo checkbox
|
|
Dim sNumberPiecesBLT As ExpanderElement = sMachGroup.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61722)) ' Recupero Numero di pezzi da BTL con relativo checkbox
|
|
Dim sNumberPiecesAdded As ExpanderElement = sMachGroup.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61723)) ' Recupero Numero di pezzi aggiunti con relativo checkbox
|
|
Dim sNumberPiecesInsertedBlanks As ExpanderElement = sMachGroup.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61724)) ' Recupero Numero di pezzi inseriti nei grezzi con relativo checkbox
|
|
Dim sNumberPiecesCompleted As ExpanderElement = sMachGroup.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61725)) ' Recupero Numero di pezzi completati con relativo checkbox
|
|
If sNumberBlanks.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.TotMachGroups_Msg & If(Not bPreview, Map.refProjectVM.MachGroupPanelVM.sTotMachGroups, "11"))
|
|
If sTotalVolume.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotVolume_Msg & If(Not bPreview, Map.refProjectVM.MachGroupPanelVM.sTotVolume, "3.168"))
|
|
If sEstimatedTotalTime.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotEstimatedTime_Msg & If(Not bPreview, Map.refProjectVM.MachGroupPanelVM.sTotEstimatedTime, "00:22:30"))
|
|
If sTotalTime.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotTime_Msg & If(Not bPreview, Map.refProjectVM.MachGroupPanelVM.sTotTime, "00:09:23"))
|
|
If sRemainingTime.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLRemainingTime_Msg & If(Not bPreview, Map.refProjectVM.MachGroupPanelVM.sRemainingTime, "00:09:23"))
|
|
If sNumberPiecesBLT.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.TotCNTParts_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sTotCNTParts, "127"))
|
|
If sNumberPiecesAdded.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.TotADDEDParts_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sTotADDEDParts, "0"))
|
|
If sNumberPiecesInsertedBlanks.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.TotINPRODParts_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sTotINPRODParts, "69"))
|
|
If sNumberPiecesCompleted.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.TotDONEParts_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sTotDONEParts, "5"))
|
|
End Sub
|
|
|
|
Public Sub DefineItemList(ByVal document As Document, nListType As ListTypes, bPreview As Boolean)
|
|
document.DefaultPageSetup.DifferentFirstPageHeaderFooter = True
|
|
'Recupero la lista delle colonne delle tabelle
|
|
Dim sMachGroupList As ExpanderTable = Nothing
|
|
If nListType = ListTypes.MACHGROUP Then
|
|
sMachGroupList = Map.refPDFEditorVM.ExpanderList.FirstOrDefault(Function(x) x.sNameCategory = EgtMsg(61730)).ExpanderElementList.FirstOrDefault() ' Lista Tabella MachGroup List
|
|
ElseIf nListType = ListTypes.RAWPART Then
|
|
sMachGroupList = Map.refPDFEditorVM.ExpanderList.FirstOrDefault(Function(x) x.sNameCategory = EgtMsg(61732)).ExpanderElementList.FirstOrDefault() ' Lista Tabella Raw Part List
|
|
ElseIf nListType = ListTypes.PART Then
|
|
sMachGroupList = Map.refPDFEditorVM.ExpanderList.FirstOrDefault(Function(x) x.sNameCategory = EgtMsg(61733)).ExpanderElementList.FirstOrDefault() ' Lista Tabella Part List
|
|
End If
|
|
Dim sName As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_NAME) ' Recupero colonna 'colName' con relativo checkbox
|
|
Dim sW As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_W) ' Recupero colonna 'colW' con relativo checkbox
|
|
Dim sH As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_H) ' Recupero colonna 'colH' con relativo checkbox
|
|
Dim sL As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_L) ' Recupero colonna 'colL' con relativo checkbox
|
|
Dim sMaterial As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_MATERIAL) ' Recupero colonna 'colMaterial' con relativo checkbox
|
|
Dim sUsage As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_USAGE) ' Recupero colonna 'colUsage' con relativo checkbox
|
|
Dim sWaste As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_WASTE) ' Recupero colonna 'colWaste' con relativo checkbox
|
|
Dim sUTime As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_UNITTIME) ' Recupero colonna 'colUnitTime' con relativo checkbox
|
|
Dim sQty As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_QTY) ' Recupero colonna 'colQuantity' con relativo checkbox
|
|
Dim sPDN As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_PDN) ' Recupero colonna 'colPDN' con relativo checkbox
|
|
Dim sDesc As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_DESC) ' Recupero colonna 'colDescription' con relativo checkbox
|
|
Dim sCNT As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_CNT) ' Recupero colonna 'colCNT' con relativo checkbox
|
|
Dim sAdded As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_ADDED) ' Recupero colonna 'colAdded' con relativo checkbox
|
|
Dim sDone As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_DONE) ' Recupero colonna 'colDone' con relativo checkbox
|
|
Dim sUVolume As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_UNITVOLUME) ' Recupero colonna 'colUnitVolume' con relativo checkbox
|
|
Dim sTVolume As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_TOTVOLUME) ' Recupero colonna 'colTotVolume' con relativo checkbox
|
|
Dim sTTime As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_TOTTIME) ' Recupero colonna 'colTotTime' con relativo checkbox
|
|
Dim sINProd As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_INPROD) ' Recupero colonna 'colInProd' con relativo checkbox
|
|
Dim section As Section = document.LastSection()
|
|
DefineItem(document, nListType, bPreview, sMachGroupList, sName, sW, sH, sL, sMaterial, sUsage, sWaste, sUTime, sQty, sPDN, sDesc, sCNT, sAdded, sDone, sUVolume, sTVolume, sTTime, sINProd, section)
|
|
End Sub
|
|
|
|
Private Sub DefineItem(document As Document, nListType As ListTypes, bPreview As Boolean, sMachGroupList As ExpanderTable, sName As EgtDataGridColumn, sW As EgtDataGridColumn, sH As EgtDataGridColumn, sL As EgtDataGridColumn, sMaterial As EgtDataGridColumn, sUsage As EgtDataGridColumn, sWaste As EgtDataGridColumn, sUTime As EgtDataGridColumn, sQty As EgtDataGridColumn, sPDN As EgtDataGridColumn, sDesc As EgtDataGridColumn, sCNT As EgtDataGridColumn, sAdded As EgtDataGridColumn, sDone As EgtDataGridColumn, sUVolume As EgtDataGridColumn, sTVolume As EgtDataGridColumn, sTTime As EgtDataGridColumn, sINProd As EgtDataGridColumn, section As Section)
|
|
Dim countItemList As Integer = 0
|
|
Select Case nListType
|
|
Case ListTypes.PART
|
|
section.AddParagraph("Part List", "Heading2")
|
|
Case ListTypes.MACHGROUP
|
|
section.AddParagraph("MachGroup List", "Heading2")
|
|
Case ListTypes.RAWPART
|
|
section.AddParagraph("RawPart List", "Heading2")
|
|
End Select
|
|
Dim table As Table = New Table()
|
|
table.Borders.Width = 0.75
|
|
' ciclo sulle colonne per creare la tabella e riempirne i campi
|
|
' -2 -> creo colonne
|
|
' -1 -> riempio colonne della riga degli header
|
|
' >=0 -> riempio le colonne con i valori dei pezzi
|
|
Dim Itemlist As IEnumerable(Of Object) = Nothing
|
|
' Controllo se bPreview è true mostra il PDF di preview se no il PDF completo
|
|
If bPreview Then
|
|
Itemlist = New List(Of Object)
|
|
Else
|
|
Select Case nListType
|
|
Case ListTypes.PART
|
|
Itemlist = Map.refProjectVM.BTLStructureVM.BTLPartVMList
|
|
Case ListTypes.MACHGROUP
|
|
Itemlist = Map.refProjectVM.MachGroupPanelVM.MachGroupVMList
|
|
Case ListTypes.RAWPART
|
|
Itemlist = Map.refStatisticsVM.RawPartList
|
|
End Select
|
|
End If
|
|
Select Case nListType
|
|
Case ListTypes.PART
|
|
Itemlist = Map.refProjectVM.BTLStructureVM.BTLPartVMList
|
|
Case ListTypes.MACHGROUP
|
|
Itemlist = Map.refProjectVM.MachGroupPanelVM.MachGroupVMList
|
|
Case ListTypes.RAWPART
|
|
If Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE Then Map.refStatisticsVM.LoadRawPart()
|
|
Itemlist = Map.refStatisticsVM.RawPartList
|
|
End Select
|
|
'If m_ActivePage = Pages.VIEW Then
|
|
' Itemlist = Map.refProjectVM.BTLStructureVM.BTLPartVMList.ToList()
|
|
'ElseIf m_ActivePage = Pages.MACHINING Then
|
|
' Itemlist = Map.refProjectVM.MachGroupPanelVM.MachGroupVMList.ToList()
|
|
'End If
|
|
countItemList = If(bPreview, Itemlist.Count, Itemlist.Count - 1)
|
|
|
|
For PartIndex = -2 To countItemList
|
|
Dim BTLPartVM As BTLPartVM = Nothing
|
|
Dim MachGroupVM As MyMachGroupVM = Nothing
|
|
Dim RawPart As SParam = Nothing
|
|
Dim row As Row = Nothing
|
|
If PartIndex <> -2 Then
|
|
' aggiungo riga
|
|
row = table.AddRow()
|
|
End If
|
|
If PartIndex = -1 Then
|
|
' imposto la riga come header che si ripetera' all'inizio di ogni pagina
|
|
row.HeadingFormat = True
|
|
' coloro sfondo riga degli header
|
|
row.Shading.Color = Colors.Aqua
|
|
ElseIf PartIndex >= 0 Then
|
|
If bPreview Then
|
|
' recupero elemento della riga
|
|
Select Case nListType
|
|
Case ListTypes.PART
|
|
BTLPartVM = Nothing
|
|
Case ListTypes.MACHGROUP
|
|
MachGroupVM = Nothing
|
|
Case ListTypes.RAWPART
|
|
RawPart = Nothing
|
|
End Select
|
|
Else
|
|
' recupero elemento della riga
|
|
Select Case nListType
|
|
Case ListTypes.PART
|
|
BTLPartVM = Map.refProjectVM.BTLStructureVM.BTLPartVMList(PartIndex)
|
|
Case ListTypes.MACHGROUP
|
|
MachGroupVM = Map.refProjectVM.MachGroupPanelVM.MachGroupVMList(PartIndex)
|
|
Case ListTypes.RAWPART
|
|
RawPart = Map.refStatisticsVM.RawPartList(PartIndex)
|
|
End Select
|
|
End If
|
|
End If
|
|
Dim Columnlist As ObservableCollection(Of EgtDataGridColumn) = Nothing
|
|
Select Case nListType
|
|
Case ListTypes.PART
|
|
'Columnlist = Map.refStatisticsVM.StatisticsColumns
|
|
Columnlist = sMachGroupList.RawPartColumns
|
|
Case ListTypes.MACHGROUP
|
|
'Columnlist = Map.refStatisticsVM.OptimizerStatisticsColumns
|
|
Columnlist = sMachGroupList.RawPartColumns
|
|
Case ListTypes.RAWPART
|
|
'Columnlist = Map.refStatisticsVM.RawPartStatisticsColumns
|
|
Columnlist = sMachGroupList.RawPartColumns
|
|
End Select
|
|
For ColumnIndex = 0 To Columnlist.Count - 1
|
|
Select Case Columnlist(ColumnIndex).Name
|
|
Case COL_PDN
|
|
If sPDN.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(1))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.PDN_Msg)
|
|
ElseIf nListType = ListTypes.PART Then
|
|
If bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph(1)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.nPDN)
|
|
End If
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
Case COL_ID
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(1.5))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.ID_Msg)
|
|
ElseIf nListType = ListTypes.MACHGROUP Then
|
|
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.Id)
|
|
End If
|
|
Case COL_W
|
|
'If PartIndex = -2 Then
|
|
' table.AddColumn(Unit.FromCentimeter(2))
|
|
'ElseIf PartIndex = -1 Then
|
|
' row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.W_Msg)
|
|
'ElseIf nListType = ListTypes.PART Then
|
|
' row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sW)
|
|
'ElseIf nListType = ListTypes.MACHGROUP Then
|
|
' row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dW)
|
|
'ElseIf nListType = ListTypes.RAWPART Then
|
|
' row.Cells(ColumnIndex).AddParagraph(RawPart.sW)
|
|
'End If
|
|
|
|
If nListType = ListTypes.PART AndAlso sW.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(1))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.W_Msg)
|
|
ElseIf bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph(200)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sW)
|
|
End If
|
|
ElseIf nListType = ListTypes.MACHGROUP AndAlso sW.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(2))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.W_Msg)
|
|
ElseIf bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph(120)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dW)
|
|
End If
|
|
ElseIf nListType = ListTypes.RAWPART AndAlso sW.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(2))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.W_Msg)
|
|
ElseIf bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph(120)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(RawPart.sW)
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
Case COL_H
|
|
'If PartIndex = -2 Then
|
|
' table.AddColumn(Unit.FromCentimeter(2))
|
|
'ElseIf PartIndex = -1 Then
|
|
' row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.H_Msg)
|
|
'ElseIf nListType = ListTypes.PART Then
|
|
' row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sH)
|
|
'ElseIf nListType = ListTypes.MACHGROUP Then
|
|
' row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dH)
|
|
'ElseIf nListType = ListTypes.RAWPART Then
|
|
' row.Cells(ColumnIndex).AddParagraph(RawPart.sH)
|
|
'End If
|
|
|
|
If nListType = ListTypes.PART AndAlso sH.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(1))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.H_Msg)
|
|
ElseIf bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph(360)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sH)
|
|
End If
|
|
ElseIf nListType = ListTypes.MACHGROUP AndAlso sH.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(2))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.H_Msg)
|
|
ElseIf bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph(160)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dH)
|
|
End If
|
|
ElseIf nListType = ListTypes.RAWPART AndAlso sH.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(2))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.H_Msg)
|
|
ElseIf bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph(160)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(RawPart.sH)
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
Case COL_L
|
|
'If PartIndex = -2 Then
|
|
' table.AddColumn(Unit.FromCentimeter(2))
|
|
'ElseIf PartIndex = -1 Then
|
|
' row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.L_Msg)
|
|
'ElseIf nListType = ListTypes.PART Then
|
|
' row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sL)
|
|
'ElseIf nListType = ListTypes.MACHGROUP Then
|
|
' row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dL)
|
|
'ElseIf nListType = ListTypes.RAWPART Then
|
|
' row.Cells(ColumnIndex).AddParagraph(RawPart.sL)
|
|
'End If
|
|
|
|
If nListType = ListTypes.PART AndAlso sL.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(1.6))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.L_Msg)
|
|
ElseIf bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph(6672.6)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sL)
|
|
End If
|
|
ElseIf nListType = ListTypes.MACHGROUP AndAlso sL.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(2))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.L_Msg)
|
|
ElseIf bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph(15000)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dL)
|
|
End If
|
|
ElseIf nListType = ListTypes.RAWPART AndAlso sL.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(2))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.L_Msg)
|
|
ElseIf bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph(15000)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(RawPart.sL)
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
Case COL_DESC
|
|
'If PartIndex = -2 Then
|
|
' table.AddColumn(Unit.FromCentimeter(4))
|
|
'ElseIf PartIndex = -1 Then
|
|
' row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg)
|
|
'ElseIf nListType = ListTypes.PART Then
|
|
' row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sNAM)
|
|
'ElseIf nListType = ListTypes.MACHGROUP Then
|
|
' row.Cells(ColumnIndex).AddParagraph(MachGroupVM.nName)
|
|
'End If
|
|
|
|
If nListType = ListTypes.PART AndAlso sDesc.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(4))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg)
|
|
ElseIf bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph("Arc.in salita smussato")
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sNAM)
|
|
End If
|
|
ElseIf nListType = ListTypes.MACHGROUP AndAlso sDesc.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(4))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg)
|
|
ElseIf bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph(1)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.nName)
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
Case COL_NAME
|
|
'If PartIndex = -2 Then
|
|
' table.AddColumn(Unit.FromCentimeter(4))
|
|
'ElseIf PartIndex = -1 Then
|
|
' row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg)
|
|
'ElseIf nListType = ListTypes.PART Then
|
|
' row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sNAM)
|
|
'ElseIf nListType = ListTypes.MACHGROUP Then
|
|
' row.Cells(ColumnIndex).AddParagraph(MachGroupVM.nName)
|
|
'End If
|
|
|
|
If nListType = ListTypes.PART AndAlso sName.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(4))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg)
|
|
ElseIf bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph("Arc.in salita smussato")
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sNAM)
|
|
End If
|
|
ElseIf nListType = ListTypes.MACHGROUP AndAlso sName.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(4))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg)
|
|
ElseIf bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph(1)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.nName)
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
Case COL_MATERIAL
|
|
'If PartIndex = -2 Then
|
|
' table.AddColumn(Unit.FromCentimeter(2))
|
|
'ElseIf PartIndex = -1 Then
|
|
' row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.MAT_Msg)
|
|
'ElseIf nListType = ListTypes.PART Then
|
|
' row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sMATERIAL)
|
|
'ElseIf nListType = ListTypes.MACHGROUP Then
|
|
' row.Cells(ColumnIndex).AddParagraph(MachGroupVM.sMATERIAL)
|
|
'ElseIf nListType = ListTypes.RAWPART Then
|
|
' row.Cells(ColumnIndex).AddParagraph(RawPart.sMaterial)
|
|
'End If
|
|
|
|
If nListType = ListTypes.PART AndAlso sMaterial.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(2))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.MAT_Msg)
|
|
ElseIf bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph("GL24h")
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sMATERIAL)
|
|
End If
|
|
ElseIf nListType = ListTypes.MACHGROUP AndAlso sMaterial.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(2))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.MAT_Msg)
|
|
ElseIf bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph("GL24h")
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.sMATERIAL)
|
|
End If
|
|
ElseIf nListType = ListTypes.RAWPART AndAlso sMaterial.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(2))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.MAT_Msg)
|
|
ElseIf bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph("GL24h")
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(RawPart.sMaterial)
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
Case COL_CNT
|
|
If sCNT.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(1.6))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.CNT_Msg)
|
|
ElseIf nListType = ListTypes.PART Then
|
|
If bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph(1)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sCNT)
|
|
End If
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
Case COL_ADDED
|
|
If sAdded.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(1.5))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.ADDED_Msg)
|
|
ElseIf nListType = ListTypes.PART Then
|
|
If bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph(0)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sADDED)
|
|
End If
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
Case COL_INPROD
|
|
If sINProd.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(2.5))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.INPROD_Msg)
|
|
ElseIf nListType = ListTypes.PART Then
|
|
If bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph(0)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.nINPROD)
|
|
End If
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
Case COL_DONE
|
|
If sDone.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(1.5))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.DONE_Msg)
|
|
ElseIf nListType = ListTypes.PART Then
|
|
If bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph(0)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.nDONE)
|
|
End If
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
Case COL_USAGE
|
|
If sUsage.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(2))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.Used_Msg)
|
|
ElseIf nListType = ListTypes.MACHGROUP Then
|
|
If bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph(99.719)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.sUsage)
|
|
End If
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
Case COL_WASTE
|
|
If sWaste.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(2))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.Waste_Msg)
|
|
ElseIf nListType = ListTypes.MACHGROUP Then
|
|
If bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph(0.5)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.sWaste)
|
|
End If
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
Case COL_UNITVOLUME
|
|
'If PartIndex = -2 Then
|
|
' table.AddColumn(Unit.FromCentimeter(2))
|
|
'ElseIf PartIndex = -1 Then
|
|
' row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.UNIT_VOLUME_Msg)
|
|
'ElseIf nListType = ListTypes.PART Then
|
|
' row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sUnitVolume)
|
|
'ElseIf nListType = ListTypes.MACHGROUP Then
|
|
' row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dUnitVolume)
|
|
'End If
|
|
|
|
If nListType = ListTypes.PART AndAlso sUVolume.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(1.5))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.UNIT_VOLUME_Msg)
|
|
ElseIf bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph(0.48)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sUnitVolume)
|
|
End If
|
|
ElseIf nListType = ListTypes.MACHGROUP AndAlso sUVolume.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(2))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.UNIT_VOLUME_Msg)
|
|
ElseIf bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph(0.48)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dUnitVolume)
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
Case COL_TOTVOLUME
|
|
If sTVolume.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(1.5))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.TOT_VOLUME_Msg)
|
|
ElseIf nListType = ListTypes.PART Then
|
|
If bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph(0.48)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sTotVolume)
|
|
End If
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
Case COL_UNITTIME
|
|
'If PartIndex = -2 Then
|
|
' table.AddColumn(Unit.FromCentimeter(2))
|
|
'ElseIf PartIndex = -1 Then
|
|
' row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.UNIT_TIME_Msg)
|
|
'ElseIf nListType = ListTypes.PART Then
|
|
' row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sUnitTime)
|
|
'ElseIf nListType = ListTypes.MACHGROUP Then
|
|
' row.Cells(ColumnIndex).AddParagraph(MachGroupVM.sUnitTime)
|
|
'End If
|
|
|
|
If nListType = ListTypes.PART AndAlso sUTime.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(2.2))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.UNIT_TIME_Msg)
|
|
ElseIf bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph("00:00:00")
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sUnitTime)
|
|
End If
|
|
ElseIf nListType = ListTypes.MACHGROUP AndAlso sUTime.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(2.2))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.UNIT_TIME_Msg)
|
|
ElseIf bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph("00:13:07")
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.sUnitTime)
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
Case COL_TOTTIME
|
|
If sTTime.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(2))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.TOT_TIME_Msg)
|
|
ElseIf nListType = ListTypes.PART Then
|
|
If bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph("00:00:00")
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sTotTime)
|
|
End If
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
Case COL_QTY
|
|
If sQty.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(2))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.QTY_Msg)
|
|
ElseIf nListType = ListTypes.RAWPART Then
|
|
If bPreview Then
|
|
row.Cells(ColumnIndex).AddParagraph(11)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(RawPart.nQuantity)
|
|
End If
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
End Select
|
|
Next
|
|
Next
|
|
' aggiungo tabella all'ultima sezione
|
|
document.LastSection.Add(table)
|
|
End Sub
|
|
|
|
Public Sub CreateRawPartPages(ByVal document As Document, bPreview As Boolean)
|
|
document.DefaultPageSetup.DifferentFirstPageHeaderFooter = False
|
|
'Recupero la lista delle colonne delle tabelle
|
|
Dim sMachGroupList As ExpanderTable = Map.refPDFEditorVM.ExpanderList.FirstOrDefault(Function(x) x.sNameCategory = EgtMsg(61731)).ExpanderElementList.FirstOrDefault() ' Lista Tabella Raw Part
|
|
Dim sPDN As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_PDN) ' Recupero colonna 'colPDN' con relativo checkbox
|
|
Dim sW As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_W) ' Recupero colonna 'colW' con relativo checkbox
|
|
Dim sH As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_H) ' Recupero colonna 'colH' con relativo checkbox
|
|
Dim sL As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_L) ' Recupero colonna 'colL' con relativo checkbox
|
|
Dim sDesc As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_DESC) ' Recupero colonna 'colDescription' con relativo checkbox
|
|
Dim sMaterial As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_MATERIAL) ' Recupero colonna 'colMaterial' con relativo checkbox
|
|
Dim nOrigMachGroupId As Integer = EgtGetCurrMachGroup()
|
|
' Controllo se bPreview è true mostra il PDF di preview se no il PDF completo
|
|
If bPreview Then
|
|
CreateRawPartPage(document, sMachGroupList, sPDN, sW, sH, sL, sDesc, sMaterial, Nothing)
|
|
Else
|
|
For Each RawPart As MyMachGroupVM In Map.refProjectVM.MachGroupPanelVM.MachGroupVMList
|
|
CreateRawPartPage(document, sMachGroupList, sPDN, sW, sH, sL, sDesc, sMaterial, RawPart)
|
|
Next
|
|
End If
|
|
|
|
'Dim paragraph As Paragraph = section.AddParagraph("Machgroup Totals", "Heading2")
|
|
'paragraph = section.AddParagraph(Map.refStatisticsVM.TotMachGroups_Msg & Map.refProjectVM.MachGroupPanelVM.sTotMachGroups)
|
|
'paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotVolume_Msg & Map.refProjectVM.MachGroupPanelVM.sTotVolume)
|
|
'paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotEstimatedTime_Msg & Map.refProjectVM.MachGroupPanelVM.sTotEstimatedTime)
|
|
'paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotTime_Msg & Map.refProjectVM.MachGroupPanelVM.sTotTime)
|
|
'paragraph = section.AddParagraph(Map.refStatisticsVM.BTLRemainingTime_Msg & Map.refProjectVM.MachGroupPanelVM.sRemainingTime)
|
|
'paragraph = section.AddParagraph(Map.refStatisticsVM.TotCNTParts_Msg & Map.refProjectVM.BTLStructureVM.sTotCNTParts)
|
|
'paragraph = section.AddParagraph(Map.refStatisticsVM.TotADDEDParts_Msg & Map.refProjectVM.BTLStructureVM.sTotADDEDParts)
|
|
'paragraph = section.AddParagraph(Map.refStatisticsVM.TotINPRODParts_Msg & Map.refProjectVM.BTLStructureVM.sTotINPRODParts)
|
|
'paragraph = section.AddParagraph(Map.refStatisticsVM.TotDONEParts_Msg & Map.refProjectVM.BTLStructureVM.sTotDONEParts)
|
|
End Sub
|
|
|
|
Private Sub CreateRawPartPage(document As Document, sMachGroupList As ExpanderTable, sPDN As EgtDataGridColumn, sW As EgtDataGridColumn, sH As EgtDataGridColumn, sL As EgtDataGridColumn, sDesc As EgtDataGridColumn, sMaterial As EgtDataGridColumn, RawPart As MyMachGroupVM)
|
|
Dim countPartVMList As Integer = 0
|
|
Dim section As Section = document.AddSection()
|
|
' cambio orientamento a verticale
|
|
Dim pgSetup As PageSetup = document.DefaultPageSetup.Clone()
|
|
pgSetup.Orientation = Orientation.Landscape
|
|
section.PageSetup = pgSetup
|
|
Dim PartVMList As IEnumerable(Of Object)
|
|
If IsNothing(RawPart) Then
|
|
PartVMList = New List(Of Object)
|
|
CreateRawPartImage(section, sMachGroupList, 7462, 1)
|
|
countPartVMList = PartVMList.Count
|
|
Else
|
|
PartVMList = RawPart.PartVMList
|
|
CreateRawPartImage(section, sMachGroupList, RawPart.Id, RawPart.Name)
|
|
countPartVMList = PartVMList.Count - 1
|
|
End If
|
|
|
|
' aggiungo tabella dei pezzi
|
|
Dim table As Table = New Table()
|
|
table.Borders.Width = 0.75
|
|
For PartIndex = -2 To countPartVMList
|
|
Dim PartVM As PartVM = Nothing
|
|
Dim row As Row = Nothing
|
|
If PartIndex <> -2 Then
|
|
' aggiungo riga
|
|
row = table.AddRow()
|
|
End If
|
|
If PartIndex = -1 Then
|
|
' imposto la riga come header che si ripetera' all'inizio di ogni pagina
|
|
row.HeadingFormat = True
|
|
' coloro sfondo riga degli header
|
|
row.Shading.Color = Colors.Aqua
|
|
ElseIf PartIndex >= 0 Then
|
|
' recupero elemento della riga
|
|
PartVM = PartVMList(PartIndex)
|
|
End If
|
|
Dim Columnlist As ObservableCollection(Of EgtDataGridColumn) = Nothing
|
|
'Columnlist = Map.refStatisticsVM.StatisticsColumns
|
|
Columnlist = sMachGroupList.RawPartColumns
|
|
For ColumnIndex = 0 To Columnlist.Count - 1
|
|
Select Case Columnlist(ColumnIndex).Name
|
|
Case COL_PDN
|
|
If sPDN.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(1.5))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.PDN_Msg)
|
|
ElseIf IsNothing(RawPart) Then
|
|
row.Cells(ColumnIndex).AddParagraph(55)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(PartVM.nPDN)
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
Case COL_W
|
|
If sW.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(2))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.W_Msg)
|
|
ElseIf IsNothing(RawPart) Then
|
|
row.Cells(ColumnIndex).AddParagraph(120)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(PartVM.sW)
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
Case COL_H
|
|
If sH.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(2))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.H_Msg)
|
|
ElseIf IsNothing(RawPart) Then
|
|
row.Cells(ColumnIndex).AddParagraph(160)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(PartVM.sH)
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
Case COL_L
|
|
If sL.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(2))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.L_Msg)
|
|
ElseIf IsNothing(RawPart) Then
|
|
row.Cells(ColumnIndex).AddParagraph(185.9)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(PartVM.sL)
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
Case COL_DESC
|
|
If sDesc.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(4))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg)
|
|
ElseIf IsNothing(RawPart) Then
|
|
row.Cells(ColumnIndex).AddParagraph("Correntini")
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(PartVM.sNAM)
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
Case COL_NAME
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(4))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg)
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(PartVM.sNAM)
|
|
End If
|
|
Case COL_MATERIAL
|
|
If sMaterial.bIsChecked Then
|
|
If PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(2))
|
|
ElseIf PartIndex = -1 Then
|
|
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.MAT_Msg)
|
|
ElseIf IsNothing(RawPart) Then
|
|
row.Cells(ColumnIndex).AddParagraph("GL24h")
|
|
Else
|
|
row.Cells(ColumnIndex).AddParagraph(PartVM.sMATERIAL)
|
|
End If
|
|
ElseIf PartIndex = -2 Then
|
|
table.AddColumn(Unit.FromCentimeter(0))
|
|
End If
|
|
End Select
|
|
Next
|
|
Next
|
|
' aggiungo tabella all'ultima sezione
|
|
section.Add(table)
|
|
End Sub
|
|
|
|
Private Sub CreateRawPartImage(section As Section, sMachGroupList As ExpanderTable, RawPartId As Integer, RawPartName As String)
|
|
' creo immagine
|
|
EgtSetCurrMachGroup(RawPartId)
|
|
'If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
|
|
' EgtSetView(VT.FRONT, False)
|
|
'Else
|
|
' EgtSetView(VT.TOP, False)
|
|
'End If
|
|
Core.ViewPanelVM.BWSetView(If(Core.ViewPanelVM.Type = BWType.BEAM, VT.FRONT, VT.TOP), False)
|
|
EgtZoom(ZM.ALL, False)
|
|
Dim sImagePath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "/Image" & RawPartId & ".png"
|
|
EgtGetImage(SM.HIDDENLINE, New Color3d(255, 255, 255), New Color3d(255, 255, 255), 3000, 1000, sImagePath)
|
|
' aggiungo immagine
|
|
If sMachGroupList.bSection_IsChecked Then section.AddParagraph(RawPartName)
|
|
If sMachGroupList.bImage_IsChecked Then
|
|
Dim Image As Image = section.AddImage(sImagePath)
|
|
Image.LockAspectRatio = True
|
|
Image.Width = Unit.FromMillimeter(275)
|
|
Image.RelativeHorizontal = RelativeHorizontal.Page
|
|
Image.RelativeVertical = RelativeHorizontal.Page
|
|
Image.Left = 30
|
|
End If
|
|
End Sub
|
|
|
|
Public Sub DefineLogo(section As Section, sImageLogo As String)
|
|
Dim Image As MigraDoc.DocumentObjectModel.Shapes.Image = section.Headers.FirstPage.AddImage(sImageLogo)
|
|
Image.Width = Unit.FromMillimeter(245)
|
|
Image.Height = Unit.FromMillimeter(40)
|
|
Image.LockAspectRatio = True
|
|
Image.RelativeVertical = RelativeVertical.Line
|
|
Image.Top = ShapePosition.Top
|
|
Image.Left = ShapePosition.Left
|
|
Image.WrapFormat.Style = WrapStyle.Through
|
|
Image.RelativeHorizontal = RelativeHorizontal.Margin
|
|
End Sub
|
|
|
|
Private Sub DrawImage(gfx As XGraphics, sImagePath As String)
|
|
Dim image As XImage = XImage.FromFile(sImagePath)
|
|
Dim x As Double = (250 - image.PixelWidth * 72 / image.HorizontalResolution) / 2
|
|
gfx.DrawImage(image, x, 0)
|
|
End Sub
|
|
''' <summary>
|
|
''' Defines the styles used in the document.
|
|
''' </summary>
|
|
Public Sub DefineStyles(ByVal document As Document)
|
|
' recupera lo stile predefinito Normal.
|
|
Dim style As Style = document.Styles("Normal")
|
|
' Because all styles are derived from Normal, the next line changes the
|
|
' font of the whole document. Or, more exactly, it changes the font of
|
|
' all styles and paragraphs that do not redefine the font.
|
|
style.Font.Name = "Arial"
|
|
|
|
' Heading1 to Heading9 are predefined styles with an outline level. An outline level
|
|
' other than OutlineLevel.BodyText automatically creates the outline (or bookmarks)
|
|
' in PDF.
|
|
|
|
style = document.Styles("Heading1")
|
|
style.Font.Name = "Tahoma"
|
|
style.Font.Size = 14
|
|
style.Font.Bold = True
|
|
style.Font.Color = Colors.DarkBlue
|
|
style.ParagraphFormat.PageBreakBefore = True
|
|
style.ParagraphFormat.SpaceAfter = 6
|
|
|
|
style = document.Styles("Heading2")
|
|
style.Font.Size = 12
|
|
style.Font.Bold = True
|
|
style.ParagraphFormat.PageBreakBefore = False
|
|
style.ParagraphFormat.SpaceBefore = 6
|
|
style.ParagraphFormat.SpaceAfter = 6
|
|
|
|
style = document.Styles("Heading3")
|
|
style.Font.Size = 10
|
|
style.Font.Bold = True
|
|
style.Font.Italic = True
|
|
style.ParagraphFormat.SpaceBefore = 6
|
|
style.ParagraphFormat.SpaceAfter = 3
|
|
|
|
style = document.Styles(StyleNames.Header)
|
|
style.ParagraphFormat.AddTabStop("16cm", TabAlignment.Right)
|
|
|
|
style = document.Styles(StyleNames.Footer)
|
|
style.ParagraphFormat.AddTabStop("8cm", TabAlignment.Center)
|
|
|
|
' Create a new style called TextBox based on style Normal
|
|
style = document.Styles.AddStyle("TextBox", "Normal")
|
|
style.ParagraphFormat.Alignment = ParagraphAlignment.Justify
|
|
style.ParagraphFormat.Borders.Width = 2.5
|
|
style.ParagraphFormat.Borders.Distance = "3pt"
|
|
style.ParagraphFormat.Shading.Color = Colors.SkyBlue
|
|
|
|
' Create a new style called TOC based on style Normal
|
|
style = document.Styles.AddStyle("TOC", "Normal")
|
|
style.ParagraphFormat.AddTabStop("16cm", TabAlignment.Right, TabLeader.Dots)
|
|
style.ParagraphFormat.Font.Color = Colors.Blue
|
|
End Sub
|
|
|
|
|
|
'''' <summary>
|
|
'''' Defines the styles used in the document.
|
|
'''' </summary>
|
|
'Public Sub DefineStyles(ByVal document As Document)
|
|
' ' recupera lo stile predefinito Normal.
|
|
' Dim style As Style = document.Styles("Normal")
|
|
' ' Because all styles are derived from Normal, the next line changes the
|
|
' ' font of the whole document. Or, more exactly, it changes the font of
|
|
' ' all styles and paragraphs that do not redefine the font.
|
|
' style.Font.Name = "Times New Roman"
|
|
|
|
' ' Heading1 to Heading9 are predefined styles with an outline level. An outline level
|
|
' ' other than OutlineLevel.BodyText automatically creates the outline (or bookmarks)
|
|
' ' in PDF.
|
|
|
|
' style = document.Styles("Heading1")
|
|
' style.Font.Name = "Tahoma"
|
|
' style.Font.Size = 14
|
|
' style.Font.Bold = True
|
|
' style.Font.Color = Colors.DarkBlue
|
|
' style.ParagraphFormat.PageBreakBefore = True
|
|
' style.ParagraphFormat.SpaceAfter = 6
|
|
|
|
' style = document.Styles("Heading2")
|
|
' style.Font.Size = 12
|
|
' style.Font.Bold = True
|
|
' style.ParagraphFormat.PageBreakBefore = False
|
|
' style.ParagraphFormat.SpaceBefore = 6
|
|
' style.ParagraphFormat.SpaceAfter = 6
|
|
|
|
' style = document.Styles("Heading3")
|
|
' style.Font.Size = 10
|
|
' style.Font.Bold = True
|
|
' style.Font.Italic = True
|
|
' style.ParagraphFormat.SpaceBefore = 6
|
|
' style.ParagraphFormat.SpaceAfter = 3
|
|
|
|
' style = document.Styles(StyleNames.Header)
|
|
' style.ParagraphFormat.AddTabStop("16cm", TabAlignment.Right)
|
|
|
|
' style = document.Styles(StyleNames.Footer)
|
|
' style.ParagraphFormat.AddTabStop("8cm", TabAlignment.Center)
|
|
|
|
' ' Create a new style called TextBox based on style Normal
|
|
' style = document.Styles.AddStyle("TextBox", "Normal")
|
|
' style.ParagraphFormat.Alignment = ParagraphAlignment.Justify
|
|
' style.ParagraphFormat.Borders.Width = 2.5
|
|
' style.ParagraphFormat.Borders.Distance = "3pt"
|
|
' style.ParagraphFormat.Shading.Color = Colors.SkyBlue
|
|
|
|
' ' Create a new style called TOC based on style Normal
|
|
' style = document.Styles.AddStyle("TOC", "Normal")
|
|
' style.ParagraphFormat.AddTabStop("16cm", TabAlignment.Right, TabLeader.Dots)
|
|
' style.ParagraphFormat.Font.Color = Colors.Blue
|
|
'End Sub
|
|
|
|
|
|
''' <summary>
|
|
''' Defines the cover page.
|
|
''' </summary>
|
|
Public Sub DefineCover(ByVal document As Document)
|
|
Dim section As Section = document.AddSection()
|
|
Dim paragraph As Paragraph = section.AddParagraph()
|
|
paragraph.Format.SpaceAfter = "3cm"
|
|
Dim image As Shapes.Image = section.AddImage("../../images/Logo landscape.png")
|
|
image.Width = "10cm"
|
|
paragraph = section.AddParagraph("A sample document that demonstrates the" & vbLf & "capabilities of MigraDoc")
|
|
paragraph.Format.Font.Size = 16
|
|
paragraph.Format.Font.Color = Colors.DarkRed
|
|
paragraph.Format.SpaceBefore = "8cm"
|
|
paragraph.Format.SpaceAfter = "3cm"
|
|
paragraph = section.AddParagraph("Rendering date: ")
|
|
paragraph.AddDateField()
|
|
End Sub
|
|
|
|
|
|
''' <summary>
|
|
''' Defines table of contents.
|
|
''' </summary>
|
|
Public Sub DefineTableOfContents(ByVal document As Document)
|
|
Dim section As Section = document.LastSection
|
|
section.AddPageBreak()
|
|
Dim paragraph As Paragraph = section.AddParagraph("Table of Contents")
|
|
paragraph.Format.Font.Size = 14
|
|
paragraph.Format.Font.Bold = True
|
|
paragraph.Format.SpaceAfter = 24
|
|
paragraph.Format.OutlineLevel = OutlineLevel.Level1
|
|
paragraph = section.AddParagraph()
|
|
paragraph.Style = "TOC"
|
|
Dim hyperlink As Hyperlink = paragraph.AddHyperlink("Paragraphs")
|
|
hyperlink.AddText("Paragraphs" & vbTab)
|
|
hyperlink.AddPageRefField("Paragraphs")
|
|
paragraph = section.AddParagraph()
|
|
paragraph.Style = "TOC"
|
|
hyperlink = paragraph.AddHyperlink("Tables")
|
|
hyperlink.AddText("Tables" & vbTab)
|
|
hyperlink.AddPageRefField("Tables")
|
|
paragraph = section.AddParagraph()
|
|
paragraph.Style = "TOC"
|
|
hyperlink = paragraph.AddHyperlink("Charts")
|
|
hyperlink.AddText("Charts" & vbTab)
|
|
hyperlink.AddPageRefField("Charts")
|
|
End Sub
|
|
|
|
|
|
''' <summary>
|
|
''' Defines page setup, headers, and footers.
|
|
''' </summary>
|
|
Private Sub DefineContentSection(ByVal document As Document)
|
|
Dim section As Section = document.AddSection()
|
|
section.PageSetup.OddAndEvenPagesHeaderFooter = True
|
|
section.PageSetup.StartingNumber = 1
|
|
|
|
Dim header As HeaderFooter = section.Headers.Primary
|
|
header.AddParagraph(vbTab & "Odd Page Header")
|
|
|
|
header = section.Headers.EvenPage
|
|
header.AddParagraph("Even Page Header")
|
|
|
|
' Create a paragraph with centered page number. See definition of style "Footer".
|
|
Dim paragraph As Paragraph = New Paragraph()
|
|
paragraph.AddTab()
|
|
paragraph.AddPageField()
|
|
' Add paragraph to footer for odd pages.
|
|
section.Footers.Primary.Add(paragraph)
|
|
' Add clone of paragraph to footer for odd pages. Cloning is necessary because an object must
|
|
' not belong to more than one other object. If you forget cloning an exception is thrown.
|
|
section.Footers.EvenPage.Add(paragraph.Clone())
|
|
End Sub
|
|
|
|
|
|
#Region "Paragraphs"
|
|
|
|
Public Sub DefineParagraphs(ByVal document As Document)
|
|
Dim paragraph As Paragraph = document.LastSection.AddParagraph("Paragraph Layout Overview", "Heading1")
|
|
paragraph.AddBookmark("Paragraphs")
|
|
DemonstrateParagraphsAlignment(document)
|
|
DemonstrateIndent(document)
|
|
DemonstrateFormattedText(document)
|
|
DemonstrateBordersAndShading(document)
|
|
End Sub
|
|
|
|
Private Sub DemonstrateParagraphsAlignment(ByVal document As Document)
|
|
document.LastSection.AddParagraph("Alignment", "Heading2")
|
|
document.LastSection.AddParagraph("Left Aligned", "Heading3")
|
|
Dim paragraph As Paragraph = document.LastSection.AddParagraph()
|
|
paragraph.Format.Alignment = ParagraphAlignment.Left
|
|
paragraph.AddText(m_TestText)
|
|
document.LastSection.AddParagraph("Right Aligned", "Heading3")
|
|
paragraph = document.LastSection.AddParagraph()
|
|
paragraph.Format.Alignment = ParagraphAlignment.Right
|
|
paragraph.AddText(m_TestText)
|
|
document.LastSection.AddParagraph("Centered", "Heading3")
|
|
paragraph = document.LastSection.AddParagraph()
|
|
paragraph.Format.Alignment = ParagraphAlignment.Center
|
|
paragraph.AddText(m_TestText)
|
|
document.LastSection.AddParagraph("Justified", "Heading3")
|
|
paragraph = document.LastSection.AddParagraph()
|
|
paragraph.Format.Alignment = ParagraphAlignment.Justify
|
|
paragraph.AddText(m_TestMediumText)
|
|
End Sub
|
|
|
|
Private Sub DemonstrateIndent(ByVal document As Document)
|
|
document.LastSection.AddParagraph("Indent", "Heading2")
|
|
document.LastSection.AddParagraph("Left Indent", "Heading3")
|
|
Dim paragraph As Paragraph = document.LastSection.AddParagraph()
|
|
paragraph.Format.LeftIndent = "2cm"
|
|
paragraph.AddText(m_TestText)
|
|
document.LastSection.AddParagraph("Right Indent", "Heading3")
|
|
paragraph = document.LastSection.AddParagraph()
|
|
paragraph.Format.RightIndent = "1in"
|
|
paragraph.AddText(m_TestText)
|
|
document.LastSection.AddParagraph("First Line Indent", "Heading3")
|
|
paragraph = document.LastSection.AddParagraph()
|
|
paragraph.Format.FirstLineIndent = "12mm"
|
|
paragraph.AddText(m_TestText)
|
|
document.LastSection.AddParagraph("First Line Negative Indent", "Heading3")
|
|
paragraph = document.LastSection.AddParagraph()
|
|
paragraph.Format.LeftIndent = "1.5cm"
|
|
paragraph.Format.FirstLineIndent = "-1.5cm"
|
|
paragraph.AddText(m_TestText)
|
|
End Sub
|
|
|
|
Private Sub DemonstrateFormattedText(ByVal document As Document)
|
|
document.LastSection.AddParagraph("Formatted Text", "Heading2")
|
|
Dim paragraph As Paragraph = document.LastSection.AddParagraph()
|
|
paragraph.AddText("Text can be formatted ")
|
|
paragraph.AddFormattedText("bold", TextFormat.Bold)
|
|
paragraph.AddText(", ")
|
|
paragraph.AddFormattedText("italic", TextFormat.Italic)
|
|
paragraph.AddText(", or ")
|
|
paragraph.AddFormattedText("bold & italic", TextFormat.Bold Or TextFormat.Italic)
|
|
paragraph.AddText(".")
|
|
paragraph.AddLineBreak()
|
|
paragraph.AddText("You can set the ")
|
|
Dim formattedText As FormattedText = paragraph.AddFormattedText("size ")
|
|
formattedText.Size = 15
|
|
paragraph.AddText("the ")
|
|
formattedText = paragraph.AddFormattedText("color ")
|
|
formattedText.Color = Colors.Firebrick
|
|
paragraph.AddText("the ")
|
|
formattedText = paragraph.AddFormattedText("font", New Font("Verdana"))
|
|
paragraph.AddText(".")
|
|
paragraph.AddLineBreak()
|
|
paragraph.AddText("You can set the ")
|
|
formattedText = paragraph.AddFormattedText("subscript")
|
|
formattedText.Subscript = True
|
|
paragraph.AddText(" or ")
|
|
formattedText = paragraph.AddFormattedText("superscript")
|
|
formattedText.Superscript = True
|
|
paragraph.AddText(".")
|
|
End Sub
|
|
|
|
Private Sub DemonstrateBordersAndShading(ByVal document As Document)
|
|
document.LastSection.AddPageBreak()
|
|
document.LastSection.AddParagraph("Borders and Shading", "Heading2")
|
|
document.LastSection.AddParagraph("Border around Paragraph", "Heading3")
|
|
Dim paragraph As Paragraph = document.LastSection.AddParagraph()
|
|
paragraph.Format.Borders.Width = 2.5
|
|
paragraph.Format.Borders.Color = Colors.Navy
|
|
paragraph.Format.Borders.Distance = 3
|
|
paragraph.AddText(m_TestMediumText)
|
|
document.LastSection.AddParagraph("Shading", "Heading3")
|
|
paragraph = document.LastSection.AddParagraph()
|
|
paragraph.Format.Shading.Color = Colors.LightCoral
|
|
paragraph.AddText(m_TestText)
|
|
document.LastSection.AddParagraph("Borders & Shading", "Heading3")
|
|
paragraph = document.LastSection.AddParagraph()
|
|
paragraph.Style = "TextBox"
|
|
paragraph.AddText(m_TestMediumText)
|
|
End Sub
|
|
|
|
#End Region ' Paragraphs
|
|
|
|
|
|
#Region "Tables"
|
|
|
|
Public Sub DefineTables(ByVal document As MigraDoc.DocumentObjectModel.Document)
|
|
Dim paragraph As Paragraph = document.LastSection.AddParagraph("Table Overview", "Heading1")
|
|
paragraph.AddBookmark("Tables")
|
|
DemonstrateSimpleTable(document)
|
|
DemonstrateTableAlignment(document)
|
|
DemonstrateCellMerge(document)
|
|
End Sub
|
|
|
|
Public Sub DemonstrateSimpleTable(ByVal document As Document)
|
|
document.LastSection.AddParagraph("Simple Tables", "Heading2")
|
|
Dim table As Table = New Table()
|
|
table.Borders.Width = 0.75
|
|
Dim column As Column = table.AddColumn(Unit.FromCentimeter(2))
|
|
column.Format.Alignment = ParagraphAlignment.Center
|
|
table.AddColumn(Unit.FromCentimeter(5))
|
|
Dim row As Row = table.AddRow()
|
|
row.Shading.Color = Colors.PaleGoldenrod
|
|
Dim cell As Cell = row.Cells(0)
|
|
cell.AddParagraph("Itemus")
|
|
cell = row.Cells(1)
|
|
cell.AddParagraph("Descriptum")
|
|
row = table.AddRow()
|
|
cell = row.Cells(0)
|
|
cell.AddParagraph("1")
|
|
cell = row.Cells(1)
|
|
cell.AddParagraph(m_TestShortText)
|
|
row = table.AddRow()
|
|
cell = row.Cells(0)
|
|
cell.AddParagraph("2")
|
|
cell = row.Cells(1)
|
|
cell.AddParagraph(m_TestText)
|
|
table.SetEdge(0, 0, 2, 3, Edge.Box, BorderStyle.Single, 1.5, Colors.Black)
|
|
document.LastSection.Add(table)
|
|
End Sub
|
|
|
|
|
|
Public Sub DemonstrateTableAlignment(ByVal document As MigraDoc.DocumentObjectModel.Document)
|
|
document.LastSection.AddParagraph("Cell Alignment", "Heading2")
|
|
Dim table As Table = document.LastSection.AddTable()
|
|
table.Borders.Visible = True
|
|
table.Format.Shading.Color = Colors.LavenderBlush
|
|
table.Shading.Color = Colors.Salmon
|
|
table.TopPadding = 5
|
|
table.BottomPadding = 5
|
|
Dim column As Column = table.AddColumn()
|
|
column.Format.Alignment = ParagraphAlignment.Left
|
|
column = table.AddColumn()
|
|
column.Format.Alignment = ParagraphAlignment.Center
|
|
column = table.AddColumn()
|
|
column.Format.Alignment = ParagraphAlignment.Right
|
|
table.Rows.Height = 35
|
|
Dim row As Row = table.AddRow()
|
|
row.VerticalAlignment = VerticalAlignment.Top
|
|
row.Cells(0).AddParagraph("Text")
|
|
row.Cells(1).AddParagraph("Text")
|
|
row.Cells(2).AddParagraph("Text")
|
|
row = table.AddRow()
|
|
row.VerticalAlignment = VerticalAlignment.Center
|
|
row.Cells(0).AddParagraph("Text")
|
|
row.Cells(1).AddParagraph("Text")
|
|
row.Cells(2).AddParagraph("Text")
|
|
row = table.AddRow()
|
|
row.VerticalAlignment = VerticalAlignment.Bottom
|
|
row.Cells(0).AddParagraph("Text")
|
|
row.Cells(1).AddParagraph("Text")
|
|
row.Cells(2).AddParagraph("Text")
|
|
End Sub
|
|
|
|
Public Sub DemonstrateCellMerge(ByVal document As Document)
|
|
document.LastSection.AddParagraph("Cell Merge", "Heading2")
|
|
Dim table As Table = document.LastSection.AddTable()
|
|
table.Borders.Visible = True
|
|
table.TopPadding = 5
|
|
table.BottomPadding = 5
|
|
Dim column As Column = table.AddColumn()
|
|
column.Format.Alignment = ParagraphAlignment.Left
|
|
column = table.AddColumn()
|
|
column.Format.Alignment = ParagraphAlignment.Center
|
|
column = table.AddColumn()
|
|
column.Format.Alignment = ParagraphAlignment.Right
|
|
table.Rows.Height = 35
|
|
Dim row As Row = table.AddRow()
|
|
row.Cells(0).AddParagraph("Merge Right")
|
|
row.Cells(0).MergeRight = 1
|
|
row = table.AddRow()
|
|
row.VerticalAlignment = VerticalAlignment.Bottom
|
|
row.Cells(0).MergeDown = 1
|
|
row.Cells(0).VerticalAlignment = VerticalAlignment.Bottom
|
|
row.Cells(0).AddParagraph("Merge Down")
|
|
table.AddRow()
|
|
End Sub
|
|
|
|
#End Region ' Tables
|
|
|
|
Public Sub DefineCharts(ByVal document As Document)
|
|
Dim paragraph As Paragraph = document.LastSection.AddParagraph("Chart Overview", "Heading1")
|
|
paragraph.AddBookmark("Charts")
|
|
document.LastSection.AddParagraph("Sample Chart", "Heading2")
|
|
Dim chart As Chart = New Chart()
|
|
chart.Left = 0
|
|
chart.Width = Unit.FromCentimeter(16)
|
|
chart.Height = Unit.FromCentimeter(12)
|
|
Dim series As Series = chart.SeriesCollection.AddSeries()
|
|
series.ChartType = ChartType.Column2D
|
|
series.Add(New Double() {1, 17, 45, 5, 3, 20, 11, 23, 8, 19})
|
|
series.HasDataLabel = True
|
|
series = chart.SeriesCollection.AddSeries()
|
|
series.ChartType = ChartType.Line
|
|
series.Add(New Double() {41, 7, 5, 45, 13, 10, 21, 13, 18, 9})
|
|
Dim xseries As XSeries = chart.XValues.AddXSeries()
|
|
xseries.Add("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N")
|
|
chart.XAxis.MajorTickMark = TickMarkType.Outside
|
|
chart.XAxis.Title.Caption = "X-Axis"
|
|
chart.YAxis.MajorTickMark = TickMarkType.Outside
|
|
chart.YAxis.HasMajorGridlines = True
|
|
chart.PlotArea.LineFormat.Color = Colors.DarkGray
|
|
chart.PlotArea.LineFormat.Width = 1
|
|
document.LastSection.Add(chart)
|
|
End Sub
|
|
|
|
End Module
|