0

I'm currently building an application that generates a separate letter for each user in the dataset. The letter contents are managed through a vb.net application and their RTF format saved to a database. When the letter is created, all the content is pulled from the database to form the letter using vb.net logic.

Once compiled it was sent as a parameter to Crystal. This worked great, setting the field text interpretation to RTF allowed proper RTF viewing. The client has decided that they would instead like to make changes to the logic (if statements that compile the text) within Crystal.

So what I did was create a blank dataset with a bunch of columns and filled those columns with the RTF (Ordered by ID so the values will never change unless a paragraph is deleted and there is no option for this). This would allow me to build an RTF string by going {table.1} + {table.2} etc...

This is where the problem is. When building an RTF string in a Formula (Using + or &) it only displays the first RTF entry. If I switch the formula to no interpretation, I can see the RTF for the entries written out with all their content so I know it’s there. I also manually combined the RTF in the formula field and had the same issue.


StringVar output;

output := output & "{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Times New Roman;}}\viewkind4\uc1\pard\lang1033\f0\fs23 this is a first test }"; output := output & "{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Times New Roman;}}\viewkind4\uc1\pard\lang1033\f0\fs23 this is a second test \par\par}";


Output

At this point I am unsure if there is a way around this other than moving all the text to separate Formula fields within crystal itself and then combine. This would mean if they wanted to change text it would have to be done within crystal. I would rather not go this route so I’m looking for opinions and suggestions.

4

1 回答 1

0

Crystal 确实支持 RTF,但它需要在 RTF 条目的第一次出现内完全形成。在我的问题中,它显示了两个单独的 COMPLETE RTF 条目。由于所有条目都有 RTF ID 标签,因此这是不可能的。如果您将上述文本复制到文本编辑器并将其保存为 RTF,也会出现同样的问题。你只会得到第一行。这并不能解释为什么它作为一个参数而不是一个公式起作用,而是它可能如何评估每个参数以及以后如何评估(参数将来可能会失去支持)。

要正确地将 RTF 传递给水晶,您需要两个富文本框对象。一个是临时框,另一个是构建框,只选择格式化文本,而不是整个 RTF 内容。这方面的一个例子可以在以下位置找到:

http://moneybaron.org/2011/08/23/vb-net-merge-rtf-documents/

除了一些技巧,例如从 RTF 字符串中删除右大括号或重建 RTF 表也是可用的,但是删除大括号可能会导致配置不受支持,并且重建会很快变得混乱。

希望这可以帮助!!

于 2013-11-21T16:02:52.223 回答