New functions pdf

This commit is contained in:
Mans 2021-03-16 15:45:30 +01:00
parent e0a5d2128f
commit 82698c46b1
3 changed files with 80 additions and 18 deletions

Binary file not shown.

View File

@ -448,8 +448,10 @@
Dim gratingTable As New DataTable Dim gratingTable As New DataTable
gratingTable.Columns.Add("TYPE", GetType(String)) gratingTable.Columns.Add("TYPE", GetType(String))
gratingTable.Columns.Add("MATERIAL", GetType(String))
gratingTable.Columns.Add("NAME", GetType(String)) gratingTable.Columns.Add("NAME", GetType(String))
gratingTable.Columns.Add("SERRATED", GetType(Boolean)) gratingTable.Columns.Add("SERRATED", GetType(Boolean))
gratingTable.Columns.Add("LACQUERED", GetType(Boolean))
gratingTable.Columns.Add("WIDTH", GetType(Integer)) gratingTable.Columns.Add("WIDTH", GetType(Integer))
gratingTable.Columns.Add("LENGTH", GetType(Integer)) gratingTable.Columns.Add("LENGTH", GetType(Integer))
gratingTable.Columns.Add("LOADBAR_THICKNESS", GetType(Integer)) gratingTable.Columns.Add("LOADBAR_THICKNESS", GetType(Integer))
@ -462,8 +464,10 @@
gratingTable.Rows.Add() gratingTable.Rows.Add()
gratingTable.Rows(0)("MATERIAL") = gratingMaterial
gratingTable.Rows(0)("NAME") = gratingName gratingTable.Rows(0)("NAME") = gratingName
gratingTable.Rows(0)("SERRATED") = gratingSerrated gratingTable.Rows(0)("SERRATED") = gratingSerrated
gratingTable.Rows(0)("LACQUERED") = gratingLacquered
gratingTable.Rows(0)("WIDTH") = CInt(Individual.ComboBox_Width.Text) gratingTable.Rows(0)("WIDTH") = CInt(Individual.ComboBox_Width.Text)
gratingTable.Rows(0)("LENGTH") = CInt(Individual.TextBox_Length.Text) gratingTable.Rows(0)("LENGTH") = CInt(Individual.TextBox_Length.Text)
gratingTable.Rows(0)("LOADBAR_THICKNESS") = CInt(Individual.ComboBox_Thickness.Text) gratingTable.Rows(0)("LOADBAR_THICKNESS") = CInt(Individual.ComboBox_Thickness.Text)

View File

@ -13,21 +13,9 @@ Public Class GUI_Export
'Page 2-X 'Page 2-X
doc.Words.Last.InsertBreak(Word.WdBreakType.wdPageBreak) doc.Words.Last.InsertBreak(Word.WdBreakType.wdPageBreak)
Generate_Screenshot() Generate_Screenshot()
Create_GratingPicture(doc)
Dim drawingPara As Word.Paragraph Create_GratingData(doc)
Dim lineRange As Word.Range = doc.Bookmarks.Item("\endofdoc").Range
drawingPara = doc.Content.Paragraphs.Add(lineRange)
drawingPara.Range.InsertParagraphBefore()
drawingPara.Format.SpaceBefore = 10
drawingPara.Range.InlineShapes.AddPicture(Individual.filepath & "\X2021\Specification_PDF\GUI.png")
drawingPara.Range.InlineShapes(1).ScaleHeight = 55
drawingPara.Range.InlineShapes(1).ScaleWidth = 55
drawingPara.Format.SpaceAfter = 10
drawingPara.Range.InsertParagraphAfter()
doc.ExportAsFixedFormat(Individual.filepath & "\X2021\Specification_PDF\Specification.pdf", Word.WdExportFormat.wdExportFormatPDF) doc.ExportAsFixedFormat(Individual.filepath & "\X2021\Specification_PDF\Specification.pdf", Word.WdExportFormat.wdExportFormatPDF)
doc.Close(False) doc.Close(False)
@ -174,9 +162,9 @@ Public Class GUI_Export
productsTable.Cell(i, 2).Range.Text = gratingTable.Rows(0)("NAME") & gratingTable.Rows(0)("LOADBAR_HEIGHT") & productsTable.Cell(i, 2).Range.Text = gratingTable.Rows(0)("NAME") & gratingTable.Rows(0)("LOADBAR_HEIGHT") &
Get_RandomNumber(10000000, 99999999) Get_RandomNumber(10000000, 99999999)
End If End If
productsTable.Cell(i, 3).Range.Text = "5" productsTable.Cell(i, 3).Range.Text = 5.ToString("### ###")
productsTable.Cell(i, 4).Range.Text = "20 000" productsTable.Cell(i, 4).Range.Text = 20000.ToString("### ###")
productsTable.Cell(i, 5).Range.Text = "100 000" productsTable.Cell(i, 5).Range.Text = (CInt(Val(productsTable.Cell(i, 3).Range.Text)) * CInt(Val(productsTable.Cell(i, 4).Range.Text))).ToString("### ###")
For j = 1 To productsTable.Columns.Count For j = 1 To productsTable.Columns.Count
productsTable.Cell(i, j).Range.Font.Size = 10 productsTable.Cell(i, j).Range.Font.Size = 10
Next Next
@ -200,7 +188,14 @@ Public Class GUI_Export
priceTable.Cell(1, 1).Range.Font.Bold = True priceTable.Cell(1, 1).Range.Font.Bold = True
priceTable.Cell(1, 1).Range.Font.Size = 20 priceTable.Cell(1, 1).Range.Font.Size = 20
priceTable.Cell(1, 2).Range.Text = "100 000" Dim totPrice As Integer = 0
For i = 2 To productsTable.Rows.Count
totPrice += CInt(Val(productsTable.Cell(i, 5).Range.Text))
Next
priceTable.Cell(1, 2).Range.Text = totPrice.ToString("### ###")
priceTable.Cell(1, 2).Range.Font.Bold = True priceTable.Cell(1, 2).Range.Font.Bold = True
priceTable.Cell(1, 2).Range.Font.Size = 20 priceTable.Cell(1, 2).Range.Font.Size = 20
@ -208,6 +203,69 @@ Public Class GUI_Export
priceTable.Cell(1, 2).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight priceTable.Cell(1, 2).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight
End Sub End Sub
Private Shared Sub Create_GratingPicture(doc As Word.Document)
Dim drawingPara As Word.Paragraph
Dim lineRange As Word.Range = doc.Bookmarks.Item("\endofdoc").Range
drawingPara = doc.Content.Paragraphs.Add(lineRange)
drawingPara.Range.InsertParagraphBefore()
drawingPara.Format.SpaceBefore = 10
drawingPara.Range.InlineShapes.AddPicture(Individual.filepath & "\X2021\Specification_PDF\GUI.png")
drawingPara.Range.InlineShapes(1).ScaleHeight = 55
drawingPara.Range.InlineShapes(1).ScaleWidth = 55
drawingPara.Format.SpaceAfter = 1
drawingPara.Range.InsertParagraphAfter()
End Sub
Private Shared Sub Create_GratingData(doc As Word.Document)
Dim gratingInfoTable As Word.Table
Dim tableRange As Word.Range = doc.Bookmarks.Item("\endofdoc").Range
gratingInfoTable = doc.Tables.Add(tableRange, 10, 2)
gratingInfoTable.Columns(1).SetWidth(80, 2)
gratingInfoTable.Rows.SetHeight(18, 2)
gratingInfoTable.Cell(1, 1).Range.Text = "Description: "
gratingInfoTable.Cell(2, 1).Range.Text = "Type: "
gratingInfoTable.Cell(3, 1).Range.Text = "Material: "
gratingInfoTable.Cell(4, 1).Range.Text = "Mesh Size: "
gratingInfoTable.Cell(5, 1).Range.Text = "Height: "
gratingInfoTable.Cell(6, 1).Range.Text = "Thickness: "
gratingInfoTable.Cell(7, 1).Range.Text = "Length: "
gratingInfoTable.Cell(8, 1).Range.Text = "Width: "
gratingInfoTable.Cell(9, 1).Range.Text = "Other: "
For i = 1 To gratingInfoTable.Rows.Count
gratingInfoTable.Cell(i, 1).Range.Font.Bold = True
Next
gratingInfoTable.Cell(1, 2).Range.Text = "Floor Grating " & gratingTable.Rows(0)("NAME") & " " &
gratingTable.Rows(0)("LOADBAR_HEIGHT") & "/" & gratingTable.Rows(0)("LOADBAR_THICKNESS")
If gratingTable.Rows(0)("TYPE") = "pressure_welded" Then
gratingInfoTable.Cell(2, 2).Range.Text = "Pressure Welded"
Else
gratingInfoTable.Cell(2, 2).Range.Text = "Type A"
End If
gratingInfoTable.Cell(3, 2).Range.Text = gratingTable.Rows(0)("MATERIAL")
gratingInfoTable.Cell(4, 2).Range.Text = gratingTable.Rows(0)("LOADBAR_SPACING") & "x" &
gratingTable.Rows(0)("CROSSBAR_SPACING") & " (" & gratingTable.Rows(0)("NAME") & ")"
gratingInfoTable.Cell(5, 2).Range.Text = gratingTable.Rows(0)("LOADBAR_HEIGHT") & " [mm]"
gratingInfoTable.Cell(6, 2).Range.Text = gratingTable.Rows(0)("LOADBAR_THICKNESS") & " [mm]"
gratingInfoTable.Cell(7, 2).Range.Text = gratingTable.Rows(0)("LENGTH") & " [mm]"
gratingInfoTable.Cell(8, 2).Range.Text = gratingTable.Rows(0)("WIDTH") & " [mm]"
If gratingTable.Rows(0)("SERRATED") AndAlso gratingTable.Rows(0)("LACQUERED") Then
gratingInfoTable.Cell(9, 2).Range.Text = "Serrated, Lacquered"
ElseIf gratingTable.Rows(0)("SERRATED") Then
gratingInfoTable.Cell(9, 2).Range.Text = "Serrated"
ElseIf gratingTable.Rows(0)("LACQUERED") Then
gratingInfoTable.Cell(9, 2).Range.Text = "Lacquered"
Else
gratingInfoTable.Cell(9, 2).Range.Text = "-"
End If
End Sub
Private Shared Function Get_RandomNumber(Min As Integer, Max As Integer) As Integer ' Private Shared Function Get_RandomNumber(Min As Integer, Max As Integer) As Integer '
Static Generator As System.Random = New System.Random() Static Generator As System.Random = New System.Random()
Return Generator.Next(Min, Max) Return Generator.Next(Min, Max)