More features added to export pdf
This commit is contained in:
parent
8144ac0336
commit
e0a5d2128f
Binary file not shown.
|
|
@ -146,35 +146,41 @@
|
|||
|
||||
' --- Draw all the lines for the panel and grating ---
|
||||
Public Shared Sub DrawingPanel_Paint(sender As Object, e As PaintEventArgs)
|
||||
' Draw grating gross area (red)
|
||||
Dim penCon As Pen = New Pen(Color.Red, 2)
|
||||
penCon.DashPattern = {4, 6}
|
||||
e.Graphics.DrawLine(penCon, Data.grossAreaPoints(0)("GUI X"), Data.grossAreaPoints(0)("GUI Y"),
|
||||
Data.grossAreaPoints(1)("GUI X"), Data.grossAreaPoints(1)("GUI Y"))
|
||||
e.Graphics.DrawLine(penCon, Data.grossAreaPoints(1)("GUI X"), Data.grossAreaPoints(1)("GUI Y"),
|
||||
Data.grossAreaPoints(2)("GUI X"), Data.grossAreaPoints(2)("GUI Y"))
|
||||
e.Graphics.DrawLine(penCon, Data.grossAreaPoints(2)("GUI X"), Data.grossAreaPoints(2)("GUI Y"),
|
||||
Data.grossAreaPoints(3)("GUI X"), Data.grossAreaPoints(3)("GUI Y"))
|
||||
e.Graphics.DrawLine(penCon, Data.grossAreaPoints(3)("GUI X"), Data.grossAreaPoints(3)("GUI Y"),
|
||||
Data.grossAreaPoints(0)("GUI X"), Data.grossAreaPoints(0)("GUI Y"))
|
||||
|
||||
' Draw grating direction symbol
|
||||
Dim symPen As Pen = New Pen(Color.Black, 1)
|
||||
For i = 0 To DirSymbolPoints.Count - 2
|
||||
e.Graphics.DrawLine(symPen, DirSymbolPoints(i)(0), DirSymbolPoints(i)(1),
|
||||
DirSymbolPoints(i + 1)(0), DirSymbolPoints(i + 1)(1))
|
||||
Next
|
||||
Draw_Grating(e.Graphics, 7)
|
||||
|
||||
' Draw arrow symbol
|
||||
Dim symPen As Pen = New Pen(Color.Black, 1)
|
||||
For i = 1 To ArrowSymbolPoints.Count - 1
|
||||
e.Graphics.DrawLine(symPen, ArrowSymbolPoints("p" & i)(0), ArrowSymbolPoints("p" & i)(1),
|
||||
ArrowSymbolPoints("p" & i + 1)(0), ArrowSymbolPoints("p" & i + 1)(1))
|
||||
Next
|
||||
|
||||
End Sub
|
||||
|
||||
Public Shared Sub Draw_Grating(g As Graphics, fontSize As Integer)
|
||||
' Draw grating gross area (red)
|
||||
Dim penCon As Pen = New Pen(Color.Red, 2)
|
||||
penCon.DashPattern = {4, 6}
|
||||
g.DrawLine(penCon, Data.grossAreaPoints(0)("GUI X"), Data.grossAreaPoints(0)("GUI Y"),
|
||||
Data.grossAreaPoints(1)("GUI X"), Data.grossAreaPoints(1)("GUI Y"))
|
||||
g.DrawLine(penCon, Data.grossAreaPoints(1)("GUI X"), Data.grossAreaPoints(1)("GUI Y"),
|
||||
Data.grossAreaPoints(2)("GUI X"), Data.grossAreaPoints(2)("GUI Y"))
|
||||
g.DrawLine(penCon, Data.grossAreaPoints(2)("GUI X"), Data.grossAreaPoints(2)("GUI Y"),
|
||||
Data.grossAreaPoints(3)("GUI X"), Data.grossAreaPoints(3)("GUI Y"))
|
||||
g.DrawLine(penCon, Data.grossAreaPoints(3)("GUI X"), Data.grossAreaPoints(3)("GUI Y"),
|
||||
Data.grossAreaPoints(0)("GUI X"), Data.grossAreaPoints(0)("GUI Y"))
|
||||
|
||||
' Draw grating direction symbol
|
||||
Dim symPen As Pen = New Pen(Color.Black, 1)
|
||||
For i = 0 To DirSymbolPoints.Count - 2
|
||||
g.DrawLine(symPen, DirSymbolPoints(i)(0), DirSymbolPoints(i)(1),
|
||||
DirSymbolPoints(i + 1)(0), DirSymbolPoints(i + 1)(1))
|
||||
Next
|
||||
|
||||
' Draw measure labels
|
||||
For i = 0 To measureLabels.Count - 1
|
||||
Dim mesName As String = measureLabels.Keys(i)
|
||||
e.Graphics.DrawString(measureLabels(mesName)(0), New Font("Microsoft Sans Serif", 7), Brushes.Black,
|
||||
g.DrawString(measureLabels(mesName)(0), New Font("Microsoft Sans Serif", fontSize), Brushes.Black,
|
||||
New Point(measureLabels(mesName)(1), measureLabels(mesName)(2)))
|
||||
Next
|
||||
|
||||
|
|
@ -182,18 +188,18 @@
|
|||
Dim penMes As Pen = New Pen(Color.Gray, 1)
|
||||
For i = 0 To sideSquareMesLine.Count - 1
|
||||
Dim mesName As String = sideSquareMesLine.Keys(i)
|
||||
e.Graphics.DrawLine(penMes, sideSquareMesLine(mesName)(0), sideSquareMesLine(mesName)(1),
|
||||
g.DrawLine(penMes, sideSquareMesLine(mesName)(0), sideSquareMesLine(mesName)(1),
|
||||
sideSquareMesLine(mesName)(2), sideSquareMesLine(mesName)(3))
|
||||
|
||||
If Data.pointsMeasurements(mesName)(2) = 1 OrElse Data.pointsMeasurements(mesName)(2) = 3 Then
|
||||
e.Graphics.DrawLine(penMes, sideSquareMesLine(mesName)(0), sideSquareMesLine(mesName)(1) + 2,
|
||||
g.DrawLine(penMes, sideSquareMesLine(mesName)(0), sideSquareMesLine(mesName)(1) + 2,
|
||||
sideSquareMesLine(mesName)(0), sideSquareMesLine(mesName)(1) - 2)
|
||||
e.Graphics.DrawLine(penMes, sideSquareMesLine(mesName)(2), sideSquareMesLine(mesName)(1) + 2,
|
||||
g.DrawLine(penMes, sideSquareMesLine(mesName)(2), sideSquareMesLine(mesName)(1) + 2,
|
||||
sideSquareMesLine(mesName)(2), sideSquareMesLine(mesName)(1) - 2)
|
||||
Else
|
||||
e.Graphics.DrawLine(penMes, sideSquareMesLine(mesName)(0) + 2, sideSquareMesLine(mesName)(1),
|
||||
g.DrawLine(penMes, sideSquareMesLine(mesName)(0) + 2, sideSquareMesLine(mesName)(1),
|
||||
sideSquareMesLine(mesName)(0) - 2, sideSquareMesLine(mesName)(1))
|
||||
e.Graphics.DrawLine(penMes, sideSquareMesLine(mesName)(0) + 2, sideSquareMesLine(mesName)(3),
|
||||
g.DrawLine(penMes, sideSquareMesLine(mesName)(0) + 2, sideSquareMesLine(mesName)(3),
|
||||
sideSquareMesLine(mesName)(0) - 2, sideSquareMesLine(mesName)(3))
|
||||
End If
|
||||
Next
|
||||
|
|
@ -215,9 +221,9 @@
|
|||
Exit For
|
||||
End If
|
||||
Next
|
||||
e.Graphics.DrawLine(Pendot, Data.angleRecessPoints.Rows(i)("GUI X"), Data.angleRecessPoints.Rows(i)("GUI Y"),
|
||||
g.DrawLine(Pendot, Data.angleRecessPoints.Rows(i)("GUI X"), Data.angleRecessPoints.Rows(i)("GUI Y"),
|
||||
p1XGUI, p1YGUI)
|
||||
e.Graphics.DrawLine(Pendot, Data.angleRecessPoints.Rows(i)("GUI X"), Data.angleRecessPoints.Rows(i)("GUI Y"),
|
||||
g.DrawLine(Pendot, Data.angleRecessPoints.Rows(i)("GUI X"), Data.angleRecessPoints.Rows(i)("GUI Y"),
|
||||
p2XGUI, p2YGUI)
|
||||
Next
|
||||
|
||||
|
|
@ -238,7 +244,7 @@
|
|||
pTemp2(1) = Data.gratingPoints.Rows(0)("GUI Y")
|
||||
End Try
|
||||
|
||||
e.Graphics.DrawLine(pen, pTemp1(0), pTemp1(1), pTemp2(0), pTemp2(1))
|
||||
g.DrawLine(pen, pTemp1(0), pTemp1(1), pTemp2(0), pTemp2(1))
|
||||
Next
|
||||
|
||||
For i = 0 To Data.gratingMiddlePoints.Rows.Count - 1
|
||||
|
|
@ -256,10 +262,9 @@
|
|||
pTemp2(1) = Data.gratingMiddlePoints.Rows(i + 1)("GUI Y")
|
||||
End If
|
||||
|
||||
e.Graphics.DrawLine(pen, pTemp1(0), pTemp1(1), pTemp2(0), pTemp2(1))
|
||||
g.DrawLine(pen, pTemp1(0), pTemp1(1), pTemp2(0), pTemp2(1))
|
||||
Next
|
||||
|
||||
|
||||
' Draw grating grid for fill area
|
||||
If AppForm.fillMode Then
|
||||
Dim dashPen As Pen = New Pen(Color.DarkGray, 1)
|
||||
|
|
@ -269,14 +274,10 @@
|
|||
For i = 0 To Grating_Fill.numOfHorizontal - 2
|
||||
Dim x As Integer
|
||||
x = Data.grossAreaPoints.Rows(0)("GUI X") + singleLength * (i + 1)
|
||||
'If Grating_Fill.lengthRevNeeded AndAlso i = Grating_Fill.numOfHorizontal - 2 Then
|
||||
' x = Data.grossAreaPoints.Rows(0)("GUI X") + singleLength * i + Grating_Fill.revLength / Data.scaleDiff
|
||||
'Else
|
||||
'x = Data.grossAreaPoints.Rows(0)("GUI X") + singleLength * (i + 1)
|
||||
'End If
|
||||
|
||||
Dim y1 As Integer = Data.grossAreaPoints.Rows(0)("GUI Y")
|
||||
Dim y2 As Integer = Data.grossAreaPoints.Rows(3)("GUI Y")
|
||||
e.Graphics.DrawLine(dashPen, x, y1, x, y2)
|
||||
g.DrawLine(dashPen, x, y1, x, y2)
|
||||
Next
|
||||
|
||||
Dim singleWidth As Integer = Grating_Fill.maxSingleWidth / Data.scaleDiff
|
||||
|
|
@ -289,10 +290,8 @@
|
|||
End If
|
||||
Dim x1 As Integer = Data.grossAreaPoints.Rows(0)("GUI X")
|
||||
Dim x2 As Integer = Data.grossAreaPoints.Rows(1)("GUI X")
|
||||
e.Graphics.DrawLine(dashPen, x1, y, x2, y)
|
||||
g.DrawLine(dashPen, x1, y, x2, y)
|
||||
Next
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Imports Word = Microsoft.Office.Interop.Word
|
||||
|
||||
Public Class Individual
|
||||
Public Shared filepath As String
|
||||
|
||||
|
|
@ -257,117 +257,7 @@ Public Class Individual
|
|||
' ---------------------------------- Export GUI ----------------------------------
|
||||
' --- When export GUI button is pressed ---
|
||||
Private Sub Button_Export_GUI_Click(sender As Object, e As EventArgs) Handles Button_Export_GUI.Click
|
||||
'Dim startPoint As New Point(Me.Left + Panel_Grating.Left, Me.Top + Panel_Grating.Top)
|
||||
Dim startPoint As New Point
|
||||
startPoint = Panel_Grating.PointToScreen(Point.Empty)
|
||||
|
||||
Dim tempImg As New Bitmap(Panel_Grating.Width - 1, Panel_Grating.Height - 1)
|
||||
Dim test As Graphics = Graphics.FromImage(tempImg)
|
||||
test.CopyFromScreen(startPoint, New Point(0, 0), tempImg.Size)
|
||||
tempImg.Save(filepath & "\X2021\Specification_PDF\GUI.png", Imaging.ImageFormat.Png)
|
||||
|
||||
|
||||
Dim doc As Word.Document = New Word.Document()
|
||||
|
||||
'doc.Content.Text = "Hello World"
|
||||
|
||||
Dim Para1 As Word.Paragraph
|
||||
Para1 = doc.Content.Paragraphs.Add
|
||||
Para1.Range.InlineShapes.AddPicture(filepath & "\X2021\Specification_PDF\Weland_Logo.png")
|
||||
doc.InlineShapes(1).ScaleHeight = 50
|
||||
doc.InlineShapes(1).ScaleWidth = 50
|
||||
Para1.Format.SpaceAfter = 30
|
||||
Para1.Range.InsertParagraphAfter()
|
||||
|
||||
Dim table1 As Word.Table
|
||||
table1 = doc.Tables.Add(doc.Bookmarks.Item("\endofdoc").Range, 4, 2)
|
||||
table1.Columns(1).SetWidth(120, 2)
|
||||
table1.Rows.SetHeight(18, 2)
|
||||
|
||||
table1.Cell(1, 1).Range.Text = "Quote Date:"
|
||||
table1.Cell(1, 2).Range.Text = Date.Today
|
||||
|
||||
table1.Cell(2, 1).Range.Text = "Order number:"
|
||||
table1.Cell(2, 2).Range.Text = "1337"
|
||||
|
||||
table1.Cell(3, 1).Range.Text = "Customer number:"
|
||||
table1.Cell(3, 2).Range.Text = "20041605"
|
||||
|
||||
table1.Cell(4, 1).Range.Text = "Sales Representative:"
|
||||
table1.Cell(4, 2).Range.Text = "Sven Svensson"
|
||||
|
||||
table1.Range.ParagraphFormat.SpaceAfter = 30
|
||||
|
||||
'table1.Range.InsertParagraphAfter()
|
||||
'table1.Range.Collapse(Word.WdCollapseDirection.wdCollapseEnd)
|
||||
|
||||
Dim oLineBreak As Word.Paragraph
|
||||
oLineBreak = doc.Content.Paragraphs.Add(doc.Bookmarks.Item("\endofdoc").Range)
|
||||
oLineBreak.Range.InsertParagraphBefore()
|
||||
oLineBreak.Range.Text = ""
|
||||
oLineBreak.Format.SpaceAfter = 0.5
|
||||
oLineBreak.Range.InsertParagraphAfter()
|
||||
|
||||
|
||||
Dim table2 As Word.Table
|
||||
table2 = doc.Tables.Add(doc.Bookmarks.Item("\endofdoc").Range, 5, 5) 'FIXA generiskt
|
||||
table2.Rows.SetHeight(18, 2)
|
||||
|
||||
For i = 1 To table2.Columns.Count
|
||||
table2.Cell(1, i).Range.Font.Color = Word.WdColor.wdColorWhite
|
||||
table2.Cell(1, i).Shading.BackgroundPatternColor = Word.WdColor.wdColorBlack
|
||||
Next
|
||||
|
||||
table2.Cell(1, 1).Range.Text = "Description"
|
||||
table2.Cell(1, 2).Range.Text = "QTY"
|
||||
table2.Cell(1, 3).Range.Text = "Art. Nr."
|
||||
table2.Cell(1, 4).Range.Text = "Unit Price"
|
||||
table2.Cell(1, 5).Range.Text = "Total Price"
|
||||
|
||||
For i = 2 To table2.Rows.Count
|
||||
table2.Cell(i, 1).Range.Text = "Floor Grating" & i
|
||||
table2.Cell(i, 2).Range.Text = "QTY"
|
||||
table2.Cell(i, 3).Range.Text = "Art. Nr."
|
||||
table2.Cell(i, 4).Range.Text = "Unit Price"
|
||||
table2.Cell(i, 5).Range.Text = "Total Price"
|
||||
|
||||
Next
|
||||
|
||||
table2.Range.ParagraphFormat.SpaceAfter = 40
|
||||
|
||||
Dim Para2 As Word.Paragraph
|
||||
Para2 = doc.Content.Paragraphs.Add
|
||||
Para2.Range.InsertParagraphBefore()
|
||||
Para2.Range.Text = "Total Price: " & "2200"
|
||||
Para2.Range.Font.Bold = True
|
||||
Para2.Range.Font.Size = 20
|
||||
Para2.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight
|
||||
Para2.Format.SpaceAfter = 24
|
||||
|
||||
Dim table3 As Word.Table
|
||||
doc.Sections(1).PageSetup.DifferentFirstPageHeaderFooter = False
|
||||
table3 = doc.Sections(1).Footers(Word.WdHeaderFooterIndex.wdHeaderFooterPrimary).Range.Tables.Add(doc.Sections(1).Footers(Word.WdHeaderFooterIndex.wdHeaderFooterPrimary).Range, 3, 2)
|
||||
|
||||
table3.Columns(1).SetWidth(360, 2)
|
||||
|
||||
table3.Cell(1, 1).Range.Text = "Phone Number: "
|
||||
table3.Cell(2, 1).Range.Text = "Email: "
|
||||
table3.Cell(3, 1).Range.Text = "Webpage: "
|
||||
|
||||
table3.Cell(1, 2).Range.Text = "0731-344 00"
|
||||
table3.Cell(2, 2).Range.Text = "info@weland.se"
|
||||
table3.Cell(3, 2).Range.Text = "www.weland.com"
|
||||
|
||||
For i = 1 To table3.Rows.Count
|
||||
table3.Cell(i, 1).Range.Font.Bold = True
|
||||
For j = 1 To table3.Columns.Count
|
||||
table3.Cell(i, j).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight
|
||||
table3.Cell(i, j).Range.Font.Size = 10
|
||||
Next
|
||||
Next
|
||||
|
||||
doc.ExportAsFixedFormat(filepath & "\X2021\Specification_PDF\Specification.pdf", Word.WdExportFormat.wdExportFormatPDF)
|
||||
doc.Close(False)
|
||||
GUI_Export.Generate_Quote()
|
||||
End Sub
|
||||
|
||||
' ---------------------------------- Back to main menu ----------------------------------
|
||||
|
|
|
|||
|
|
@ -448,6 +448,7 @@
|
|||
|
||||
Dim gratingTable As New DataTable
|
||||
gratingTable.Columns.Add("TYPE", GetType(String))
|
||||
gratingTable.Columns.Add("NAME", GetType(String))
|
||||
gratingTable.Columns.Add("SERRATED", GetType(Boolean))
|
||||
gratingTable.Columns.Add("WIDTH", GetType(Integer))
|
||||
gratingTable.Columns.Add("LENGTH", GetType(Integer))
|
||||
|
|
@ -461,7 +462,8 @@
|
|||
|
||||
gratingTable.Rows.Add()
|
||||
|
||||
gratingTable.Rows(0)("SERRATED") = False 'Hämta från GUI
|
||||
gratingTable.Rows(0)("NAME") = gratingName
|
||||
gratingTable.Rows(0)("SERRATED") = gratingSerrated
|
||||
gratingTable.Rows(0)("WIDTH") = CInt(Individual.ComboBox_Width.Text)
|
||||
gratingTable.Rows(0)("LENGTH") = CInt(Individual.TextBox_Length.Text)
|
||||
gratingTable.Rows(0)("LOADBAR_THICKNESS") = CInt(Individual.ComboBox_Thickness.Text)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,215 @@
|
|||
Imports Word = Microsoft.Office.Interop.Word
|
||||
Public Class GUI_Export
|
||||
Private Shared gratingTable As New DataTable
|
||||
Public Shared Sub Generate_Quote()
|
||||
gratingTable = User_Input.Create_ExportTable()
|
||||
|
||||
Dim doc As Word.Document = New Word.Document()
|
||||
|
||||
'Page 1
|
||||
Create_HeaderFooter(doc)
|
||||
Create_QuoteInfo(doc)
|
||||
Create_ProductsInfo(doc)
|
||||
|
||||
'Page 2-X
|
||||
doc.Words.Last.InsertBreak(Word.WdBreakType.wdPageBreak)
|
||||
|
||||
Generate_Screenshot()
|
||||
|
||||
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 = 10
|
||||
drawingPara.Range.InsertParagraphAfter()
|
||||
|
||||
|
||||
|
||||
doc.ExportAsFixedFormat(Individual.filepath & "\X2021\Specification_PDF\Specification.pdf", Word.WdExportFormat.wdExportFormatPDF)
|
||||
doc.Close(False)
|
||||
End Sub
|
||||
|
||||
Private Shared Sub Generate_Screenshot()
|
||||
'Dim startPoint As New Point(Me.Left + Panel_Grating.Left, Me.Top + Panel_Grating.Top)
|
||||
'Dim startPoint As New Point
|
||||
'startPoint = Individual.Panel_Grating.PointToScreen(Point.Empty)
|
||||
|
||||
'Dim tempImg As New Bitmap(Individual.Panel_Grating.Width - 1, Individual.Panel_Grating.Height - 1)
|
||||
'Dim test As Graphics = Graphics.FromImage(tempImg)
|
||||
'test.CopyFromScreen(startPoint, New Point(0, 0), tempImg.Size)
|
||||
'tempImg.Save(Individual.filepath & "\X2021\Specification_PDF\GUI.png", Imaging.ImageFormat.Png)
|
||||
|
||||
|
||||
Dim gratingImg As New Bitmap(Individual.Panel_Grating.Width - 1, Individual.Panel_Grating.Height - 1)
|
||||
Dim graphicImg As Graphics = Graphics.FromImage(gratingImg)
|
||||
|
||||
Draw_Grating.Draw_Grating(graphicImg, 12)
|
||||
|
||||
gratingImg.Save(Individual.filepath & "\X2021\Specification_PDF\GUI.png", Imaging.ImageFormat.Png)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Shared Sub Create_HeaderFooter(doc As Word.Document)
|
||||
doc.Sections(1).PageSetup.DifferentFirstPageHeaderFooter = False
|
||||
|
||||
'Header
|
||||
Dim headerTable As Word.Table
|
||||
headerTable = doc.Sections(1).Headers(Word.WdHeaderFooterIndex.wdHeaderFooterPrimary).Range.
|
||||
Tables.Add(doc.Sections(1).Headers(Word.WdHeaderFooterIndex.wdHeaderFooterPrimary).Range, 1, 2)
|
||||
|
||||
headerTable.Cell(1, 1).Range.InlineShapes.AddPicture(Individual.filepath & "\X2021\Specification_PDF\Weland_Logo.png")
|
||||
headerTable.Cell(1, 1).Range.InlineShapes(1).ScaleHeight = 50
|
||||
headerTable.Cell(1, 1).Range.InlineShapes(1).ScaleWidth = 50
|
||||
|
||||
headerTable.Cell(1, 2).Range.Text = "QUOTE"
|
||||
headerTable.Cell(1, 2).Range.Font.Size = 18
|
||||
headerTable.Cell(1, 2).Range.Font.Bold = True
|
||||
headerTable.Cell(1, 2).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight
|
||||
headerTable.Cell(1, 2).VerticalAlignment = Word.WdVerticalAlignment.wdAlignVerticalBottom
|
||||
|
||||
'Footer
|
||||
Dim footerTable As Word.Table
|
||||
footerTable = doc.Sections(1).Footers(Word.WdHeaderFooterIndex.wdHeaderFooterPrimary).Range.
|
||||
Tables.Add(doc.Sections(1).Footers(Word.WdHeaderFooterIndex.wdHeaderFooterPrimary).Range, 3, 2)
|
||||
footerTable.Columns(1).SetWidth(360, 2)
|
||||
|
||||
footerTable.Cell(1, 1).Range.Text = "Phone Number: "
|
||||
footerTable.Cell(2, 1).Range.Text = "Email: "
|
||||
footerTable.Cell(3, 1).Range.Text = "Webpage: "
|
||||
|
||||
footerTable.Cell(1, 2).Range.Text = "0731-344 00"
|
||||
footerTable.Cell(2, 2).Range.Text = "info@weland.se"
|
||||
footerTable.Cell(3, 2).Range.Text = "www.weland.com"
|
||||
|
||||
For i = 1 To footerTable.Rows.Count
|
||||
footerTable.Cell(i, 1).Range.Font.Bold = True
|
||||
For j = 1 To footerTable.Columns.Count
|
||||
footerTable.Cell(i, j).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight
|
||||
footerTable.Cell(i, j).Range.Font.Size = 10
|
||||
Next
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Shared Sub Create_QuoteInfo(doc)
|
||||
Dim lineBreak As Word.Paragraph
|
||||
lineBreak = doc.Content.Paragraphs.Add
|
||||
lineBreak.Range.InsertParagraphBefore()
|
||||
lineBreak.Range.Text = ""
|
||||
lineBreak.Format.SpaceAfter = 20
|
||||
lineBreak.Range.InsertParagraphAfter()
|
||||
|
||||
Dim infoTable As Word.Table
|
||||
Dim tableRange As Word.Range = doc.Bookmarks.Item("\endofdoc").Range
|
||||
infoTable = doc.Tables.Add(tableRange, 4, 2)
|
||||
infoTable.Columns(1).SetWidth(120, 2)
|
||||
infoTable.Rows.SetHeight(18, 2)
|
||||
|
||||
Dim date2 As Date = Date.Today
|
||||
|
||||
infoTable.Cell(1, 1).Range.Text = "Quote Date:"
|
||||
infoTable.Cell(1, 2).Range.Text = date2.ToString("dd-MM-yyyy")
|
||||
|
||||
infoTable.Cell(2, 1).Range.Text = "Order number:"
|
||||
infoTable.Cell(2, 2).Range.Text = date2.ToString("ddMMyyyy") & Get_RandomNumber(10000, 99999)
|
||||
|
||||
infoTable.Cell(3, 1).Range.Text = "Customer number:"
|
||||
infoTable.Cell(3, 2).Range.Text = Get_RandomNumber(10000, 99999)
|
||||
|
||||
infoTable.Cell(4, 1).Range.Text = "Sales Representative:"
|
||||
infoTable.Cell(4, 2).Range.Text = "Sven Svensson"
|
||||
End Sub
|
||||
|
||||
Private Shared Sub Create_ProductsInfo(doc)
|
||||
Dim lineBreak As Word.Paragraph
|
||||
Dim lineRange As Word.Range = doc.Bookmarks.Item("\endofdoc").Range
|
||||
lineBreak = doc.Content.Paragraphs.Add(lineRange)
|
||||
lineBreak.Range.InsertParagraphBefore()
|
||||
lineBreak.Range.Text = ""
|
||||
lineBreak.Format.SpaceAfter = 10
|
||||
lineBreak.Range.InsertParagraphAfter()
|
||||
|
||||
Dim productsTable As Word.Table
|
||||
Dim tableRange As Word.Range = doc.Bookmarks.Item("\endofdoc").Range
|
||||
productsTable = doc.Tables.Add(tableRange, 5, 5) 'FIXA generiskt
|
||||
productsTable.Rows.SetHeight(18, 2)
|
||||
productsTable.Columns(1).SetWidth(240, 2)
|
||||
productsTable.Columns(2).SetWidth(78, 2)
|
||||
productsTable.Columns(3).SetWidth(40, 2)
|
||||
productsTable.Columns(4).SetWidth(60, 2)
|
||||
productsTable.Columns(5).SetWidth(52, 2)
|
||||
|
||||
For c = 1 To productsTable.Columns.Count
|
||||
productsTable.Cell(1, c).Range.Font.Color = Word.WdColor.wdColorWhite
|
||||
productsTable.Cell(1, c).Shading.BackgroundPatternColor = Word.WdColor.wdColorBlack
|
||||
productsTable.Cell(1, c).VerticalAlignment = Word.WdVerticalAlignment.wdAlignVerticalBottom
|
||||
If c > 2 Then
|
||||
For r = 1 To productsTable.Rows.Count
|
||||
productsTable.Cell(r, c).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight
|
||||
Next
|
||||
End If
|
||||
If c = 5 Then
|
||||
For r = 2 To productsTable.Rows.Count
|
||||
productsTable.Cell(r, c).Range.Font.Bold = True
|
||||
Next
|
||||
End If
|
||||
Next
|
||||
|
||||
productsTable.Cell(1, 1).Range.Text = "Description"
|
||||
productsTable.Cell(1, 2).Range.Text = "Art. Nr."
|
||||
productsTable.Cell(1, 3).Range.Text = "QTY"
|
||||
productsTable.Cell(1, 4).Range.Text = "Unit Price"
|
||||
productsTable.Cell(1, 5).Range.Text = "Price"
|
||||
|
||||
For i = 2 To productsTable.Rows.Count
|
||||
productsTable.Cell(i, 1).Range.Text = "Floor Grating " & gratingTable.Rows(0)("NAME") & " " &
|
||||
gratingTable.Rows(0)("LOADBAR_HEIGHT") & "/" & gratingTable.Rows(0)("LOADBAR_THICKNESS")
|
||||
If gratingTable.Rows(0)("SERRATED") Then
|
||||
productsTable.Cell(i, 2).Range.Text = gratingTable.Rows(0)("NAME").substring(0, 1) & "S" &
|
||||
gratingTable.Rows(0)("LOADBAR_HEIGHT") & Get_RandomNumber(10000000, 99999999)
|
||||
Else
|
||||
productsTable.Cell(i, 2).Range.Text = gratingTable.Rows(0)("NAME") & gratingTable.Rows(0)("LOADBAR_HEIGHT") &
|
||||
Get_RandomNumber(10000000, 99999999)
|
||||
End If
|
||||
productsTable.Cell(i, 3).Range.Text = "5"
|
||||
productsTable.Cell(i, 4).Range.Text = "20 000"
|
||||
productsTable.Cell(i, 5).Range.Text = "100 000"
|
||||
For j = 1 To productsTable.Columns.Count
|
||||
productsTable.Cell(i, j).Range.Font.Size = 10
|
||||
Next
|
||||
Next
|
||||
|
||||
|
||||
Dim lineBreak2 As Word.Paragraph
|
||||
lineRange = doc.Bookmarks.Item("\endofdoc").Range
|
||||
lineBreak2 = doc.Content.Paragraphs.Add(lineRange)
|
||||
lineBreak2.Range.InsertParagraphBefore()
|
||||
lineBreak2.Range.Text = ""
|
||||
lineBreak2.Format.SpaceAfter = 20
|
||||
lineBreak2.Range.InsertParagraphAfter()
|
||||
|
||||
Dim priceTable As Word.Table
|
||||
tableRange = doc.Bookmarks.Item("\endofdoc").Range
|
||||
priceTable = doc.Tables.Add(tableRange, 1, 2)
|
||||
priceTable.Columns(1).SetWidth(370, 2)
|
||||
|
||||
priceTable.Cell(1, 1).Range.Text = "Total Price:"
|
||||
priceTable.Cell(1, 1).Range.Font.Bold = True
|
||||
priceTable.Cell(1, 1).Range.Font.Size = 20
|
||||
|
||||
priceTable.Cell(1, 2).Range.Text = "100 000"
|
||||
priceTable.Cell(1, 2).Range.Font.Bold = True
|
||||
priceTable.Cell(1, 2).Range.Font.Size = 20
|
||||
|
||||
priceTable.Cell(1, 1).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight
|
||||
priceTable.Cell(1, 2).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight
|
||||
End Sub
|
||||
|
||||
Private Shared Function Get_RandomNumber(Min As Integer, Max As Integer) As Integer '
|
||||
Static Generator As System.Random = New System.Random()
|
||||
Return Generator.Next(Min, Max)
|
||||
End Function
|
||||
End Class
|
||||
|
|
@ -114,6 +114,7 @@
|
|||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="Quote_Export\GUI_Export.vb" />
|
||||
<Compile Include="Recess Functions\Corner_Angle.vb" />
|
||||
<Compile Include="Recess Functions\Corner_Rectangle.vb" />
|
||||
<Compile Include="Recess Functions\Middle_Rectangle.vb" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue