Output is to the word document (docx).
I would like to make outuput like this using C# 4.0 string.Format:
string1: stringValue1, string2:stringValue2
string4: stringValue4, string5:stringValue5
string6: stringValue6, string7:stringValue7
string8: stringValue8, string9:stringValue9
I am using string.Format("{0,-10} {1,-10}",string1,string2) but it does nothing. Is there a way how to align strings using string.Format()? I saw '\t' solution but how to add it into string.Fornmat()?
Here is my code and my output:
string titel = HttpUtility.HtmlEncode(docItem.Title);
string href = docItem.FullURL;
string title = string.Format("{0}", titel);
string author = docItem.Author;
string date = docItem.ChangedDate.Date.ToShortDateString();
CreateTextBoxConentParagraph(doc, string.Format("Title: <a href='{0}'>{1}</a> Author: {2} Geändert an: {3}",href,title.PadRight(20),author.PadRight(20), date),string.Format("chunkId_{0}", i++));
Output: Title: Author: aaa Geändert an: 19.04.2013
Title: second Author: aaa Geändert an: 18.04.2013
Title: slika Author: aaa Geändert an: 18.04.2013
Title: d m Author: aaa Geändert an: 18.04.2013
Title: Mathias Author: aaa Geändert an: 19.04.2013
Title: QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQqq Author: aaa Geändert an: 19.04.2013
string.Fornmatdoes not exist.\tinto your format string anywhere (e.g.string.Format("\t{0}\t{1}", ...)). What is the significant part of your output? How do you want your strings to be aligned?