格式化图表的标题

时间:2023-01-14 15:29:19

Does anyone of you know a way to format the caption of a chart in Crystal Reports? I have a number that stands for a specific year, this number is 4 digits long. I wnat the caption to be shown like:

你们中的任何人都知道在Crystal Reports中格式化图表标题的方法吗?我有一个代表特定年份的数字,这个数字是4位数。我把标题显示为:

2009

But the current way its shown is

但它显示的当前方式是

2.009

EDIT: The years are dynamically load from the database and in the DB they are stored as a datetime Field that i select by using the year function...

编辑:年份是从数据库动态加载,在数据库中它们存储为日期时间我使用年份函数选择的字段...

1 个解决方案

#1


I don't know anything about crystal reports. You should mention that in the question title, or at least in the question itself, not just in the tags.

我对水晶报道一无所知。你应该在问题标题中提及,或者至少在问题本身中,而不仅仅是在标签中。

I suppose you could use a real DateTime object (instead of an int) for the date and use some function to format dates to display only the year. Like this guy:

我想你可以使用一个真实的DateTime对象(而不是int)作为日期,并使用一些函数来格式化日期以仅显示年份。喜欢这个家伙:

For example, I need a date formatting as following: 23-Mar-2007 The following formula will do the trick: ToText({MYFIELDNAME }, "dd-MMM-yyyy")

例如,我需要一个日期格式如下:23-Mar-2007以下公式将起作用:ToText({MYFIELDNAME},“dd-MMM-yyyy”)

That relates to field names, but I suppose you can use the same function (ToText) for the caption of the chart?

这与字段名称有关,但我想你可以使用相同的函数(ToText)作为图表的标题?

You could also store the year in a string.

您还可以将年份存储在字符串中。

#1


I don't know anything about crystal reports. You should mention that in the question title, or at least in the question itself, not just in the tags.

我对水晶报道一无所知。你应该在问题标题中提及,或者至少在问题本身中,而不仅仅是在标签中。

I suppose you could use a real DateTime object (instead of an int) for the date and use some function to format dates to display only the year. Like this guy:

我想你可以使用一个真实的DateTime对象(而不是int)作为日期,并使用一些函数来格式化日期以仅显示年份。喜欢这个家伙:

For example, I need a date formatting as following: 23-Mar-2007 The following formula will do the trick: ToText({MYFIELDNAME }, "dd-MMM-yyyy")

例如,我需要一个日期格式如下:23-Mar-2007以下公式将起作用:ToText({MYFIELDNAME},“dd-MMM-yyyy”)

That relates to field names, but I suppose you can use the same function (ToText) for the caption of the chart?

这与字段名称有关,但我想你可以使用相同的函数(ToText)作为图表的标题?

You could also store the year in a string.

您还可以将年份存储在字符串中。