Modify ZPL File

Harakiri
Member Posts: 8
Hi there,
I need to find a solution for NAV 5.0 (so no fancy DOTNET stuff possible). I need to modify a ZPL file and add a new line at the very beginning of the document. In standard it is possible to write into a document at the end of the document, which works fine (but it's not what i need). Even if I set the pointer to the first char in the text file it will just overwrite any following characters - so that's not possible either. Here's the working solution:
That does everything I need. However, the ZPL printer is so picky when it comes to the format (e.g. many empty lines) of that file it doesn't print it, even if it's a legit ZPL file.
Do you know any other way to modify an existing file and just add a first line to it? If not: Maybe someone will run into that problem some day and hopefully my code above is of any help
Thanks a lot,
-S
I need to find a solution for NAV 5.0 (so no fancy DOTNET stuff possible). I need to modify a ZPL file and add a new line at the very beginning of the document. In standard it is possible to write into a document at the end of the document, which works fine (but it's not what i need). Even if I set the pointer to the first char in the text file it will just overwrite any following characters - so that's not possible either. Here's the working solution:
IF LabelFile2.OPEN(DecompressedFilePath) THEN BEGIN LabelFile2.CREATEINSTREAM(StreamIn); FirstRow := 'This needs to be the first line'; BigString.ADDTEXT(FirstRow); BigString.ADDTEXT(CRLF); WHILE NOT StreamIn.EOS DO BEGIN StreamIn.READTEXT(TextLine); BigString.ADDTEXT(TextLine); BigString.ADDTEXT(CRLF); END; IF LabelFile2.CREATE('\\PRINTFILES\' + 'test'+ '.zpl') THEN BEGIN LabelFile2.CREATEOUTSTREAM(StreamOut); BigString.WRITE(StreamOut); LabelFile2.CLOSE; END ELSE BEGIN ERROR('Error!'); END; END ELSE BEGIN ERROR('Cannot open Labelfile'); END;
That does everything I need. However, the ZPL printer is so picky when it comes to the format (e.g. many empty lines) of that file it doesn't print it, even if it's a legit ZPL file.
Do you know any other way to modify an existing file and just add a first line to it? If not: Maybe someone will run into that problem some day and hopefully my code above is of any help

Thanks a lot,
-S
0
Best Answer
-
I actually fixed it. I was using CRLF for a new line. (Chars = CR := 10 and LF := 13). I just stripped out LF (Line Feed). That's it. Problem solved.0
Answers
-
I actually fixed it. I was using CRLF for a new line. (Chars = CR := 10 and LF := 13). I just stripped out LF (Line Feed). That's it. Problem solved.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions