早上好!
我希望有人可以帮助我解决一个可能很简单的问题,但我无法让事情按照我想要的方式工作。我目前正在处理具有“包罗万象”文本字段的报告。在此字段中,用户可以输入他们想要的任何内容,并且有时会以列格式输入信息(例如 1.1)。此字段允许用于在此字段中创建“行”的回车。问题是用户希望此字段中的“列”在报告中对齐,而不必在输入信息时计算列之间的空格(例如 1.2)。问题是即使输入了此类信息,也没有设置协议或格式指南。可能有多个“字幕”,行,由字幕分隔的行等。
我目前正在尝试将每一行分开,根据需要对每一行进行格式化,然后将其重新组合在一起,如下所示:
Dim output As String
Dim sections as String
Dim returnCount as Int
Dim leftText as String
Dim rightText as String
Dim sectionTogether as String
Dim totalText as String
Dim textLength as Int
output = {table.textfield}
sections = ExtractString(output, Chr(10), Chr(10))
If Instr(sections," ") > 0 Then
leftText = Left(sections, Instr(sections, " "))
textLength = Length(Left(sections, Instr(sections, " "))
rightText = Right(sections, Instr(sections, " "))
Replace(sections," "," ")
sectionTogether = rightText + (Space(20) - (textLength - 3)) + leftText
totalText = totalText + sectionTogether
formula = totalText
else
formula = output
这是我正在尝试做的事情的要点。几点注意事项:1)我知道我缺少某种循环来格式化每个部分,但我不知道如何在水晶中设置它 2)我有 VB 编程经验,但我对水晶及其有限的工具不熟悉所以我感到手足无措,我很难找到我将在 Visual Studio 3 中使用的方法和工具)我的语法也可能在一些地方不正确,因为我仍在学习如何设置它,我真的很想念调试器。
我希望有人可以帮助我,我已经研究了一个多星期,感觉就像我的头撞到了墙上。
先感谢您。
The output examples
ex. 1.1
"Your current charges are:
Jan 12.89
Feb 117.44
Mar 15.02
Apr 4.17"
ex. 1.2
"Your current charges are:
Jan 12.89
Feb 117.44
Mar 15.02
Apr 4.17"