473,320 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

AppendFormat - System.Text.Stringbuilder issues

gchq
96
Hi there

I'm attempting to put together a string that will line up in columns and then insert this into a pdf form! I've managed this before, but for some reason the columns do not line up this time - been over every inch of the code and cannot fnd a reason - if anyone can spot the obvious I'd really appreciate it!

Expand|Select|Wrap|Line Numbers
  1. Dim vInfo As New System.Text.StringBuilder()
  2.  
  3.         vInfo.AppendFormat("{0, -14} {1, 30} {2, 30}", "Earnings", "This Period", "Year to Date")
  4.         vInfo.Append(vbCr)
  5.         vInfo.Append(vbCr)
  6.         vInfo.AppendFormat("{0, -14} {1, 30} {2, 30}", "Basic Pay", Format(vBasic, "###,##0.00"), Format(vYTDBasic, "###,##0.00"))
  7.         vInfo.Append(vbCr)
  8.         vInfo.AppendFormat("{0, -14} {1, 30} {2, 30} ", "IEC Pay", Format(vIEC, "###,##0.00"), Format(vYTDIEC, "###,##0.00"))
  9.         vInfo.Append(vbCr)
  10.         vInfo.AppendFormat("{0, -14} {1, 30} {2, 30}", "Sick Pay", Format(vSickPay, "###,##0.00"), Format(vYTDSickPay, "###,##0.00"))
  11.         vInfo.Append(vbCr)
  12.         vInfo.AppendFormat("{0, -14} {1, 30} {2, 30}", "Vacation Pay", Format(vVacationPay, "###,##0.00"), Format(vYTDVacationPay, "###,##0.00"))
  13.         vInfo.Append(vbCr)
  14.         vInfo.AppendFormat("{0, -14} {1, 30} {2, 30}", "Bonus", Format(vBonusPay, "###,##0.00"), Format(vYTDBonus, "###,##0.00"))
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.         Dim TK As APToolkitNET.Toolkit
  23.         Dim vOutput As String
  24.         Dim sString As String = Request.ServerVariables("APPL_PHYSICAL_PATH")
  25.         Dim rtnOutput As Object
  26.         Dim rtnInput As Object
  27.  
  28.         TK = New APToolkitNET.Toolkit
  29.         vOutput = sString & "Secure\Admin\Management\Accounting\pdf\PayCheck.pdf"
  30.         rtnOutput = TK.OpenOutputFile(vOutput)
  31.         If rtnOutput <> 0 Then
  32.             MsgBox1.alert("PDF output file error " & rtnOutput)
  33.             Exit Sub
  34.         End If
  35.  
  36.         rtnInput = TK.OpenInputFile(Server.MapPath("Chq.pdf"))
  37.         If rtnInput <> 0 Then
  38.             MsgBox1.alert("PDF input file error " & rtnInput)
  39.             Exit Sub
  40.         End If
  41.  
  42.         'Get all the information together to add to the advice
  43.         Dim vInsert As String = vInfo.ToString
  44.  
  45.         TK.FormNumbering = True
  46.  
  47.         'Get the info for the pdf form
  48.         TK.SetFormFieldData("Text1", vtToday, -998)
  49.         TK.SetFormFieldData("Text2", vPayee, -998)
  50.         TK.SetFormFieldData("Text3", vNet, -998)
  51.         TK.SetFormFieldData("Text4", vNetWords, -998)
  52.         TK.SetFormFieldData("Text5", "Payroll Check", -998)
  53.         TK.SetFormFieldData("Text7", vInsert, -998)
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.         TK.FlattenRemainingFormFields = True
  61.         Dim vCopyForm = TK.CopyForm(0, 0)
  62.         If vCopyForm <> 1 Then
  63.             MsgBox1.alert("PDF copyform failed, " & vCopyForm)
  64.         End If
  65.         TK.CloseOutputFile()
  66.         TK.CloseInputFile()
  67.         TK = Nothing
  68.  
  69.  
Jul 18 '07 #1
0 1770

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: hplloyd | last post by:
I am using some code off the web that requires a string builder in a script within a web page. In order to get the script to work I need to include the relevant library in the references section...
0
by: Bob | last post by:
I am using an API that needs a function pointer with the following prototype: void CALLBACK DXLExportStreamFunc ( const BYTE *bytes, DWORD length, void far *Context ) I get to pass it the...
0
by: Arne Adams | last post by:
Hi changing a StringBuilder through a deduced type throws an exception - Sample Code void editBuilder(System::Text::StringBuilder* t System::String* insertThis = S"inserted"...
2
by: Ben | last post by:
I have several pages written in aspx, but sometime the aspx page return the following error. And it hapeen, the whole web application gives this error, that means all the aspx files get affected....
2
by: John A Grandy | last post by:
when using StringBuilder to build-up a block of text (which is then assigned to a Label control) is it possible to underline a portion of the text ? it would seem that...
7
by: Mark Rae | last post by:
Hi, Has anyone successfully used the FTP stuff in the System.Net namespace against a VMS FTP server? I'm trying to do this at the moment and can't even get a directory listing, although there...
3
by: ramhog | last post by:
Hello all, I would like to use AppendFormat to replace tokens in a string with actual string values. The problem I am running into however is that my string uses {} around a string that I do not...
11
by: Peter Larsen [] | last post by:
Hi, I have two questions related to the Label control. How do i prevent the label from expand the canvas into 2 lines (word wrap) ?? At the moment i set AutoSize to false (to prevent the word...
5
by: SSekar | last post by:
Hi, I am getting this exceptions when I am trying to access the Frotran dll. Here is sample code for that. using System; using System.Collections.Generic; using System.Text; using...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.