Dynamic text watermark how to do

The watermark is embedded in some of the identification information to an information carrier, without affecting the contents of the original vector used for the original author to provide the means to identify, prevent tampering then again, it is an effective method of information security and intellectual property rights protection.

Speaking watermark, common to file paper after printing the resulting commonly used Word or pdf editing, and offie or pdf software also has features directly increase the watermark.

Increase as a watermark in Word is simple: the menu bar "design" - "Watermark" (select "Custom Watermark"), you can set the picture or text watermark category.

But only to set a watermark content with a word, which can only be static watermark, can not dynamically generated, as in the above text watermark "word" is "is the word I Watermark", the word can only provide this fixed watermark , unless modified edit word again.

As the data presented statistics frequently used in the show, when you export and print the watermark it will also require support. But the difference is, do watermark by reporting tools in addition to static watermark can also be dynamic.

For example, dynamically generated reports based on the same report template, query results from different users need different watermark content protection do dynamic watermark is a much-needed function.

For example, "Joe Smith" to access the template to generate reports watermark "Joe Smith reports"

"John Doe" when access was "John Doe Report"

In fact, this feature is the reporting tool of the advantages, the report also supports dynamic addition to static watermark watermark.

We Run Dry reporting tools, for example, introduce how to add a watermark (watermark images have a special article describes, do not make the comparison)? The process is not as simple as word?

First, static text watermark

Text content is doing a good report when fixed information, can only be changed by modifying the report template.

 

Secondly, dynamic watermarks

With a report every time you visit, can be passed to the watermark information currently displayed, add watermark dynamic content, other ways:

(1) dynamic parameters set by the statements and expressions watermark content

(2) show the label (watermark-property) by filling the report

Such as, generateWaterMark = "watermark."

Next we introduce the process with examples of specific actions:

Ps: Examples borrow Run Dry product comes demo applications, "reports a mesh" under "Basic Report"

First, add a static watermark

1, open and edit the "grid-style report" template

Menu - Reports - Report Properties - background image, select "watermark"

2, define the watermark information to be displayed

在“文本”输入框内输入要在报表内显示的水印内容,如“该报表版权归属润乾公司”

3、 保存模板并在浏览器预览水印效果

以上便是静态水印的设置方式,当需要更改显示内容时,只能基于报表模板重复以上步骤。另外,水印可以调整的样式包括水平或倾斜方式、字体颜色、间距等。导出及打印时也同时保留水印。

二、添加动态水印

1、 方式一:参数 + 水印内容表达式

(1) 增加报表参数

定义参数为 userID,用于接收当前用户 ID

(2) 编辑水印内容表达式

编辑“网格式报表”,菜单栏“报表”-“报表属性”-“背景图”- 水印

“来源”-“表达式”

表达式为:@userID+”的报表”

(3) 预览结果

张三访问时,userID 为“张三”,结果

李四访问

2、 方式二:通过报表标签的的水印属性值

(1)打开并编辑报表展现的 Jsp 文件

添加接收水印内容参数值的方法:

String waterMark = request.getParameter(“waterMark”);

(2)标签内添加 generateWaterMark 属性

添加属性并定义接收到的水印参数:

(3)访问报表并设置 waterMark 参数

如:http://localhost:6868/demo/reportJsp/showReport.jsp?rpx=10 基本报表 / 网格式报表.rpx&waterMark= 该报表版权所属方为润乾公司

结果:

将 waterMark 值改为“该报表版权所属方为北京润乾公司”

可以看到水印内容对应发生改变。

通过以上方式即可实现润乾报表中添加静态及动态水印,比 word 工具功能齐全,方法操作简单,属性设置丰富。

Guess you like

Origin www.cnblogs.com/shiGuangShiYi/p/12109580.html