Pdf output of GUI
This commit is contained in:
parent
0106aace4f
commit
49e4ecf33f
Binary file not shown.
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
Imports Word = Microsoft.Office.Interop.Word
|
||||
Public Class Individual
|
||||
Public Shared filepath As String '= "C:\Users\Anton\Documents\Exjobb"
|
||||
'Public Shared filepath As String = "C:\Users\xperd\Documents"
|
||||
Public Shared filepath As String
|
||||
|
||||
Sub Load_GUI()
|
||||
' Initialize GUI
|
||||
|
|
@ -258,7 +257,21 @@ 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 & "\Screenshot.png", Imaging.ImageFormat.Png)
|
||||
|
||||
|
||||
Dim doc As Word.Document = New Word.Document()
|
||||
doc.Content.Text = "Hello World"
|
||||
doc.Content.InlineShapes.AddPicture(filepath & "\Screenshot.png")
|
||||
doc.ExportAsFixedFormat(filepath & "\myfilename.pdf", Word.WdExportFormat.wdExportFormatPDF)
|
||||
doc.Close(False)
|
||||
End Sub
|
||||
|
||||
' ---------------------------------- Back to main menu ----------------------------------
|
||||
|
|
|
|||
|
|
@ -170,6 +170,15 @@
|
|||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
<COMReference Include="Microsoft.Office.Interop.Word">
|
||||
<Guid>{00020905-0000-0000-C000-000000000046}</Guid>
|
||||
<VersionMajor>8</VersionMajor>
|
||||
<VersionMinor>7</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>primary</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
<COMReference Include="SldWorks">
|
||||
<Guid>{83A33D31-27C5-11CE-BFD4-00400513BB57}</Guid>
|
||||
<VersionMajor>28</VersionMajor>
|
||||
|
|
|
|||
Loading…
Reference in New Issue