Optmizer 2.7.11.12

-piccole modfiche grafiche al pdf
This commit is contained in:
Demetrio Cassarino
2025-11-28 11:40:37 +01:00
parent 7fceefc63e
commit 43893b19ce
2 changed files with 33 additions and 52 deletions
@@ -67,5 +67,5 @@ Imports System.Windows
' Revision
'
<Assembly: AssemblyVersion("2.7.11.11")>
<Assembly: AssemblyFileVersion("2.7.11.11")>
<Assembly: AssemblyVersion("2.7.11.12")>
<Assembly: AssemblyFileVersion("2.7.11.12")>
@@ -60,8 +60,8 @@ Module PDFFlowHelper
Private Sub DefinePartTotals(flowDoc As FlowDocument, bPreview As Boolean)
Dim titlePara As New Paragraph(New Run(EgtMsg(61734) & "s")) With {
.FontSize = 14,
.Foreground = Brushes.DarkBlue,
.FontSize = 12,
.FontWeight = FontWeights.Bold,
.Margin = New Thickness(0, 35, 0, 6)
}
@@ -97,8 +97,8 @@ Module PDFFlowHelper
Public Sub DefineMachGroupTotals(flowDoc As FlowDocument, bPreview As Boolean)
Dim titlePara As New Paragraph(New Run(EgtMsg(61729))) With {
.FontSize = 14,
.Foreground = Brushes.DarkBlue,
.FontSize = 12,
.FontWeight = FontWeights.Bold,
.Margin = New Thickness(0, 35, 0, 6)
}
@@ -198,7 +198,7 @@ Module PDFFlowHelper
End Select
Dim titleParagraph As New Paragraph(New Run(titleText)) With {
.FontSize = 12,
.FontSize = 14,
.Foreground = Brushes.DarkBlue,
.FontWeight = FontWeights.Bold
}
@@ -223,8 +223,7 @@ Module PDFFlowHelper
Dim table As New Table With {
.CellSpacing = 0,
.FontSize = 10,
.BorderThickness = New Thickness(0)
.FontSize = 10
}
Dim Columnlist As ObservableCollection(Of EgtDataGridColumn) = sMachGroupList.RawPartColumns
@@ -299,7 +298,7 @@ Module PDFFlowHelper
End Select
If isVisible Then
column.Width = New GridLength(widthCm, GridUnitType.Auto)
column.Width = New GridLength(widthCm * 40, GridUnitType.Pixel)
Else
column.Width = New GridLength(0.1, GridUnitType.Pixel) ' Colonna nascosta
End If
@@ -341,13 +340,10 @@ Module PDFFlowHelper
Dim colDef As EgtDataGridColumn = Columnlist(ColumnIndex)
If PartIndex = -1 AndAlso ColumnIndex = 0 Then
' Prima cella in alto a sinistra → tutti i lati
thickness = New Thickness(0.0125, 0.5, 0.0125, 0.5)
ElseIf PartIndex = -1 Then
' Intestazioni (prima riga) → bordo sopra + destro + basso
thickness = New Thickness(0, 0.5, 0.0125, 0.5)
ElseIf ColumnIndex = 0 Then
' Prima colonna → bordo sinistro + destro + basso
thickness = New Thickness(0.0125, 0, 0, 0.5)
ElseIf ColumnIndex = Columnlist.Count - 1 Then
thickness = New Thickness(0.0125, 0, 0.0125, 0.5)
@@ -358,7 +354,7 @@ Module PDFFlowHelper
Dim cell As New TableCell With {
.BorderBrush = Brushes.Black,
.BorderThickness = thickness,
.Padding = New Thickness(5, 1, 1, 1),
.Padding = New Thickness(5, 2, 5, 0),
.TextAlignment = TextAlignment.Justify,
.FontSize = 10
}
@@ -596,38 +592,32 @@ Module PDFFlowHelper
End Sub
Private Sub CreateRawPartPage(flowDoc As FlowDocument, sMachGroupList As ExpanderTable, sPDN As EgtDataGridColumn, sW As EgtDataGridColumn, sH As EgtDataGridColumn, sL As EgtDataGridColumn, sDesc As EgtDataGridColumn, sMaterial As EgtDataGridColumn, RawPart As MyMachGroupVM, bPreview As Boolean)
Dim PartVMList As IEnumerable(Of Object)
If RawPart Is Nothing Then
PartVMList = New List(Of Object)
CreateRawPartImage(flowDoc, sMachGroupList, 44143, "Preview", bPreview)
Else
PartVMList = RawPart.PartVMList
CreateRawPartImage(flowDoc, sMachGroupList, RawPart.Id, RawPart.Name, bPreview)
End If
CreateRawPartImage(flowDoc, sMachGroupList, If(IsNothing(RawPart), 44143, RawPart.Id), If(IsNothing(RawPart), "Preview", RawPart.Name), bPreview)
Dim table As New Table With {
.CellSpacing = 0,
.FontSize = 10
}
Dim Columnlist As ObservableCollection(Of EgtDataGridColumn) = sMachGroupList.RawPartColumns
Dim visibleColumns As New List(Of EgtDataGridColumn)
' Colonne visibili
For Each col In Columnlist
Dim showCol As Boolean = False
Dim width As Double = 0
Dim column As New TableColumn()
Select Case col.Name
Case COL_PDN : showCol = sPDN.bIsChecked : width = 80
Case COL_W : showCol = sW.bIsChecked : width = 120
Case COL_H : showCol = sH.bIsChecked : width = 120
Case COL_L : showCol = sL.bIsChecked : width = 120
Case COL_DESC : showCol = sDesc.bIsChecked : width = 200
Case COL_NAME : showCol = True : width = 200
Case COL_MATERIAL : showCol = sMaterial.bIsChecked : width = 120
Case COL_PDN : showCol = sPDN.bIsChecked : width = 1.0
Case COL_W : showCol = sW.bIsChecked : width = 2.0
Case COL_H : showCol = sH.bIsChecked : width = 2.0
Case COL_L : showCol = sL.bIsChecked : width = 2.0
Case COL_DESC : showCol = sDesc.bIsChecked : width = 4.0
Case COL_NAME : showCol = True : width = 4.0
Case COL_MATERIAL : showCol = sMaterial.bIsChecked : width = 2.0
End Select
If showCol Then
table.Columns.Add(New TableColumn() With {.Width = New GridLength(width)})
column.Width = New GridLength(width * 40, GridUnitType.Pixel)
table.Columns.Add(column)
visibleColumns.Add(col)
End If
Next
@@ -635,20 +625,17 @@ Module PDFFlowHelper
' Header
Dim headerGroup As New TableRowGroup()
Dim headerRow As New TableRow()
Dim colName As String = String.Empty
For colIndex As Integer = 0 To visibleColumns.Count - 1
Dim col = visibleColumns(colIndex)
colName = ConvertColumnToMessage(col.Name)
Dim left As Double = If(colIndex = 0, 0.25, 0)
'Dim right As Double = If(colIndex = visibleColumns.Count - 1, 0.5, 0.5)
For Index As Integer = 0 To visibleColumns.Count - 1
Dim visibleCol = visibleColumns(Index)
Dim colName As String = ConvertColumnToMessage(visibleCol.Name)
Dim cell As New TableCell(New Paragraph(New Run(colName))) With {
.Background = Brushes.Aqua,
.BorderBrush = Brushes.Black,
.BorderThickness = New Thickness(0.25, 0.5, 0.25, 0.5),
.Padding = New Thickness(5, 1, 1, 1),
.TextAlignment = TextAlignment.Center,
.FontSize = 12
.BorderThickness = New Thickness(1.255, 1.26, 1, 0.5),
.Padding = New Thickness(5, 2, 5, 0),
.FontSize = 12,
.FontWeight = FontWeights.Bold,
.TextAlignment = TextAlignment.Justify
}
headerRow.Cells.Add(cell)
Next
@@ -657,14 +644,13 @@ Module PDFFlowHelper
' Dati
Dim bodyGroup As New TableRowGroup()
Dim PartVMList As IEnumerable(Of Object) = If(IsNothing(RawPart), New List(Of Object), RawPart.PartVMList)
For r As Integer = 0 To PartVMList.Count - 1
Dim part = PartVMList(r)
Dim row As New TableRow()
For c As Integer = 0 To visibleColumns.Count - 1
Dim col = visibleColumns(c)
For Each col In visibleColumns
Dim text As String = ""
Select Case col.Name
Case COL_PDN : If sPDN.bIsChecked Then text = part.nPDN.ToString()
Case COL_W : If sW.bIsChecked Then text = part.sW
@@ -675,24 +661,19 @@ Module PDFFlowHelper
Case COL_MATERIAL : If sMaterial.bIsChecked Then text = part.sMATERIAL
End Select
Dim left As Double = If(c = 0, 0.25, 0)
Dim cell As New TableCell(New Paragraph(New Run(text))) With {
.BorderBrush = Brushes.Black,
.BorderThickness = New Thickness(0.25, 0, 0.25, 0.5),
.Padding = New Thickness(5, 1, 1, 1),
.TextAlignment = TextAlignment.Justify,
.BorderThickness = New Thickness(0.5, 0.0125, 0.5, 0.0125),
.Padding = New Thickness(5, 2, 5, 0),
.TextAlignment = TextAlignment.Left,
.FontSize = 10
}
row.Cells.Add(cell)
Next
bodyGroup.Rows.Add(row)
Next
table.RowGroups.Add(bodyGroup)
' Aggiungo tabella al documento
flowDoc.Blocks.Add(table)
End Sub