在 Infragistics Ultragrid 中格式化字符串以包含制表符
我一直在使用 Infragistics Ultragrid,并且正在寻找有用的提示。我正在使用 SQL Server 2008 中的表来填充我的网格。我调用的表有一列已更新为如下所示。 “物品”+ char(9) + char(9) + “成本”+ char(13) + char(10)。 该列的“项目”部分的长度被填充为 50 个字符,后跟两个制表符、成本,然后是新行字符。最终,这就是单行的结果。请注意物品和成本如何集中到一个单元格中。
Customer A Chips and Soda $5.00
Chips $2.50
Burger and Fries $8.00
Fish and Chips $7.50
Hot Dogs $4.50
当我在 Management studio 中打印 sql server 结果时,它按预期工作。问题是,当我在 Ultragrid Cell 中打印结果时,它看起来更像是这样:
Customer A Chips and Soda $5.00
Chips $2.50
Burger and Fries $8.00
Fish and Chips $7.50
Hot Dogs $4.50
需要注意的一件事是,当我复制单元格中的内容并将其粘贴到记事本时,它看起来像顶部表格。我想知道空白的宽度是否比实际字符短。如果这有道理吗?无论如何,我怎样才能将输出处理得像上面的表一样?谢谢-P狗
I've been working with an Infragistics Ultragrid and I'm looking for a helpful hint. I'm using a table from SQL Server 2008 to populate my grid. The table that I'm calling has a column that has been updated to be something like this. "Items" + char(9) + char(9) + "Cost" + char(13) + char(10).
The "Items" section of the column is padded to be 50 charcters in length followed with the two tab characters, the cost then the new line characters. Ultimately this is what the results of a single row would look like. Notice how the items and the cost are lumped into a single cell.
Customer A Chips and Soda $5.00
Chips $2.50
Burger and Fries $8.00
Fish and Chips $7.50
Hot Dogs $4.50
When I print my sql server results in Management studio it works as intended. The problems is that when I print the results in the Ultragrid Cell it looks more like this:
Customer A Chips and Soda $5.00
Chips $2.50
Burger and Fries $8.00
Fish and Chips $7.50
Hot Dogs $4.50
One thing to note is that when I copy the contents in the cell and paste them to notepad it looks like the top table. I'm wondering if the width of the empty spaces is shorter than an actual character. If that makes sense? In any case how can I handle the output to be like the top table? Thanks - P Dog
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
感谢 Davide,我的解决方案是将单元格中的字体显示为“Lucinda Sans Typewriter”。现在我了解了固定宽度字体(monotype)和可变宽度字体(例如 Microsoft Sans Serif)之间的区别。
Thanks to Davide, my solution was to have the font in the cell be displayed as "Lucinda Sans Typewriter." Now I understand the difference between fixed width fonts (monotype) and variable width fonts like Microsoft Sans Serif.