大家好。 我从数据库输入,其中包含描述和货币金额。 我必须将这些描述和金额放入电子邮件(或NotePad类型表)的列中,我会疯狂地试图获得金额排队。 描述可能是EG: aaaaaaaaaa AAAAAAAAAA 和金额分别为99.99和120.55。请注意,每个描述中有10个。 如果我使用类似的东西:
theString =说明& - &金额循环然后我最终得到的列不对齐如下: aaaaaaaaaa - 99.99 AAAAAAAAAA - 120.55 使用.Length属性是没有意义的,因为两个描述字符串的长度都是10个字符。 有人可以建议我怎么做。 我尝试过使用padding和FixedLength但是没有用。 我有也尝试使用制表符(Chr(9)),但这也不起作用,因为描述的长度是相同的。
解决方案只有两种方法行事情: 1)你需要指定字体:你需要一个非比例字体 - 这意味着所有字符都是相同的宽度。所以i与W相同。 Courier是一个不错的选择,它适用于大多数系统。 2)你需要能够以非字符增量指定标签点:像素,或者毫米。这更难,因为它取决于应用程序。 我?我会使用Courier! 其HTML将是: 正常< span > < FONT FACE = Courier New > Courier < / span >
感谢您的澄清。 如果电子邮件客户端支持html格式,请将数据放在html(table)标签之间: < table > <! - 标题 - > < tr > < th > 说明< / th > < ; th > 金额< / th > < / tr > <! - 行 - > < tr > < td > AAAAAAAA < / td > < td > 99 < / td > < / tr > < tr > < ; td > aaaaaaa & / td > < td > 126 < / td > < / tr > < / table >
结果:
AAAAAAAA | 99 |
AAAAAAA | 126 |
Hi again everyone. I have input from a database which consists of a Description and a currency Amount. I have to put these descriptions and amounts into an email (or NotePad type sheet) in columns and I am going crazy trying to get the amounts to line up. The descriptions may be EG: aaaaaaaaaa AAAAAAAAAA and the amounts 99.99 and 120.55 respectively. Note that there are 10 a's in each description. if I use something like :
theString = Description & " - " & Amountin a loop then I end up with columns that are not aligned like: aaaaaaaaaa - 99.99 AAAAAAAAAA - 120.55 Using the .Length attribute is pointless because both Description strings are 10 characters in length. Could someone please suggest how I could do this. I have tried using padding and FixedLength but to no avail. I have also tried using tabs (Chr(9)) but that also does not work because the lengths of Description are the same.
解决方案 There are only two ways to "line things up": 1) You need to specify the font: you need a "non-proportional" font - which means all teh characters are the same width. So "i" is the same as "W". Courier is a good choice, and it's on most systems. 2) You need to be able to specify tab points in non-character increments: pixels perhaps, or millimeters. This is harder, as it depends on teh application. Me? I'd use Courier! The HTML for that would be: Normal <span><FONT FACE= "Courier New">Courier</span>Thank you for clarification. If email client supports html format, put the data between html (table) tags: <table> <!-- headers --> <tr><th>Description</th><th>Amount</th></tr> <!-- rows --> <tr><td>AAAAAAAA</td><td>99</td></tr> <tr><td>aaaaaaa</td><td>126</td></tr> </table>Result:
AAAAAAAA | 99 |
aaaaaaa | 126 |
更多推荐
将数据放在打开的表单上的列中
发布评论