Hvordan får man en printer til at skifte linje selv? \"Autolinefeed\"
Jeg har lavet et program der printer ud fra en Access database! Og nogle af felterne indeholder mere end der kan stå og så fortsætter linjen bare ud fra papiret! Jeg har ladet mig fortælle at man kan sætte en printer til \"Autolinefeed\" men jeg kan ikke finde ud af hvordan! Printeren er en HP 4100 og en HP 1100 laserjet! Er der nogen der ved hvordan man gør?? Eller om det kan gøres i koden?? Og hvis man kan i koden, så hvordan?
When you say that your printing \"ud fra en Access database\" do you mean that the data is commíng from an Access dB or that you are printing a report via Access?
If your taking the data from Access and printing it via a VB program then you can send a VBCrLf to the printer when ever you want.
But I would also have thought that your printer did it Automatically.
c.aa.t> If I understand your question correctly you have problems with the contents of some lines containing too many characters for the line. For example, the lines such as
Printer.Print \" _______________________________________________________________\" get prined OK and they also get followed by a new line. But lines such as Printer.Print \"Tlf:\"; \" \"; txbtlf.Text may get printed incorrectly.
I suggest that you place the contents of a line into a string. Then make a function which scans the line inserting a VBCrLf (This is the same as Chr(10) + Chr(13)) after each 80 characters.
This is just a VERY simple way to do it but it works and it may give you some idea\'s.
You make a function like this:
Function LineFormat(sLine As String) As String Dim i As Integer Dim j As Integer
j = 0 LineFormat = \"\" For i = 1 To Len(sLine) j = j + 1 If j = 80 Then LineFormat = LineFormat & vbCrLf j = 1 End If LineFormat = LineFormat & Mid(sLine, i, 1)
Next i
End Function
Then you replace the lines such as: Printer.Print \"Kontakt:\"; \" \"; txbkont.Text
No. I would suggest that you only replace the lines where you are having problems. I would think its thoughs where you are printing the contents of a text field such as
Printer.Print \"Kontakt:\"; \" \"; txbkont.Text
You would just replace the line with Printer.Print LineFormat(\"Kontakt:\" & \" \" & txbkont.Text)
I keep getting errors! Private Sub cmdprint_Click() is highlighted
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.