I\'m trying to print in PDF two columns of information that contain some strings that the user inputs. This is my code so far:
string s = \"\";
int width = 6
i have tried this below. It worked for me. you are using (60 - name.size) for name width but you are not using (name.width) for AAA. if you use this then total width will be = (60 - name.size) + name.size = 60. [I think this is what you are wanting.]. good luck.
string name = "John Edward Jr.";
string surname = "Pascal Einstein W. Alfi";
string school = "St. John";
string s = "";
int charWidth = 0;
int width = 60 - name.Count();
charWidth = name.Count();
s = s + string.Format("{0,-" + width + "}" + "{1," + charWidth + "}", "Name: " + name, "AAA: ");
Console.WriteLine(s);
s = "";
width = 60 - surname.Count();
charWidth = surname.Count();
s = s + string.Format("{0,-" + width + "}" + "{1," + charWidth + "}", "Surname: " + surname, "BBB: ");
Console.WriteLine(s);
s = "";
width = 60 - school.Count();
charWidth = school.Count();
s = s + string.Format("{0,-" + width + "}" + "{1," + charWidth + "}", "School: " + school, "CCC: ");
Console.WriteLine(s);