Index: TAOR-rework-bugfixing/TAOR rework/Rework/PrinterBacklogDocMapper.vb =================================================================== diff -u -r1597 -r1607 --- TAOR-rework-bugfixing/TAOR rework/Rework/PrinterBacklogDocMapper.vb (.../PrinterBacklogDocMapper.vb) (revision 1597) +++ TAOR-rework-bugfixing/TAOR rework/Rework/PrinterBacklogDocMapper.vb (.../PrinterBacklogDocMapper.vb) (revision 1607) @@ -3,47 +3,46 @@ Imports Microsoft.Office.Interop Imports Microsoft.Office.Interop.Word -Namespace Rework - Module PrinterBacklogDocMapper - Public Sub addPrinterBacklogDoc(trayNummer As Integer, text As String, isSpecial As Boolean) - Dim bestandsPath As String = Configs.printerBacklogPath - Dim trayNummerTekst As String = trayNummer.ToString - 'vullen met nullen - For index = 1 To 4 - trayNummerTekst.Length - trayNummerTekst = "0" & trayNummerTekst - Next - Dim bestandsnaam As String = "printer_backlog_" & trayNummerTekst - If isSpecial Then - bestandsnaam &= "_Special" - End If - Dim fullPath As String = Path.Combine(bestandsPath, bestandsnaam) - Dim oWord As Object - Dim oDoc As Object - Try - oWord = CreateObject("Word.Application") - oDoc = New Word.Document - Catch ex As Exception - Throw New Exception("Print backlog kon niet worden aangemaakt, omdat Word niet is geïnstalleerd") - End Try - Try +Module PrinterBacklogDocMapper + Public Sub addPrinterBacklogDoc(trayNummer As Integer, text As String, isSpecial As Boolean) + Dim bestandsPath As String = Configs.printerBacklogPath + Dim trayNummerTekst As String = trayNummer.ToString + 'vullen met nullen + For index = 1 To 4 - trayNummerTekst.Length + trayNummerTekst = "0" & trayNummerTekst + Next - Dim oPara1 As Paragraph = oDoc.Content.Paragraphs.Add - oPara1.Range.Font.Name = "Courier New" - oPara1.Range.Font.Bold = False - oPara1.Range.Font.Size = 13 - oPara1.Range.Text = text + Dim bestandsnaam As String = "printer_backlog_" & trayNummerTekst + If isSpecial Then + bestandsnaam &= "_Special" + End If + Dim fullPath As String = Path.Combine(bestandsPath, bestandsnaam) + Dim oWord As Object + Dim oDoc As Object + Try + oWord = CreateObject("Word.Application") + oDoc = New Word.Document + Catch ex As Exception + Throw New Exception("Print backlog kon niet worden aangemaakt, omdat Word niet is geïnstalleerd") + End Try + Try - oDoc.SaveAs2(fullPath) - Dim save_changes As Object = False - oDoc.Close(save_changes) - oWord.Quit(save_changes) + Dim oPara1 As Paragraph = oDoc.Content.Paragraphs.Add + oPara1.Range.Font.Name = "Courier New" + oPara1.Range.Font.Bold = False + oPara1.Range.Font.Size = 13 + oPara1.Range.Text = text - Catch ex As Exception - Throw New Exception("Print backlog kon niet worden aangemaakt" & vbNewLine & ex.Message) - End Try - End Sub + oDoc.SaveAs2(fullPath) + Dim save_changes As Object = False + oDoc.Close(save_changes) + oWord.Quit(save_changes) - End Module -End Namespace \ No newline at end of file + Catch ex As Exception + Throw New Exception("Print backlog kon niet worden aangemaakt" & vbNewLine & ex.Message) + End Try + End Sub + +End Module \ No newline at end of file