Description:
Insert a report, an image or text at the position specified by a bookmark in a template file.
Syntax:
reportlite_insert(D, bookmark, content)
Note:
External library function (See ReportLite User Reference).
At the position specified by parameter bookmark, the function inserts a report, an image or text specified by parameter content or replaces the existing content with them while keeping the original text layout or image size.
Parameter:
D |
The DocxChanger object. |
bookmark |
Name of the bookmark in a docx template file. |
content |
The report, image or text to be inserted or replaced. |
Option:
@p |
Paginate a report before inserting it. |
Return value:
Boolean
Example:
|
A |
|
1 |
=reportlite_open("D:\\wordFile.docx") |
Read template file wordFile.docx. |
2 |
=reportlite_insert(A1,"Text1","插入的测试文字") |
There isn’t content at the position specified by bookmark “Text1”, so the text is directly inserted there. |
3 |
=reportlite_insert(A1,"Text2","替换掉模板的文字") |
There is content at the position specified by bookmark “Text2”, so replace the existing content with the new text while keeping the original layout. |
4 |
=img=file("D:\\pic.jpg") |
|
5 |
=reportlite_insert(A1,"Image1",img) |
There isn’t content at the position specified by bookmark “Image1”, so insert the image pic.jpg directly there. |
6 |
=reportlite_insert(A1,"Image2",img) |
There is an image at the position specified by bookmark “Image2”, so replace it with pic.jpg while keeping the original size. |
7 |
=reportlite_open("D:\\test.rptx") |
|
8 |
=reportlite_run(A7) |
Compute report file test.rptx. |
9 |
=reportlite_insert@p(A1,"Report1",A7) |
There isn’t content at the position specified by bookmark “Report1”, @p option enables directly inserting a paginated report. |
10 |
=reportlite_write(A1,"D:\\outFile.docx") |
|
Related function: