Copy and paste a table (tablix) in SSRS

半世苍凉 提交于 2019-12-03 22:07:52

You are likely getting the error message Report Builder was unable to paste successfully because somewhere in the grid there is a cell that uses Custom Code From the Report

i.e. you cannot copy a textbox with this custom code: “Code.MyCustomeCode()”
- Report Builder was unable to paste successfully

This has been a reported bug since SSRS 2008:

When using Visual Studio 2008 to create new reports, we cannot copy and paste multiple textboxes in a tablix, and receive a popup error stating "Report Builder was unable to paste successfully"
- Unable to copy and paste textboxes in SSRS reports with Custom Code after 2008 R2 SP2 upgrade

Workaround:

  1. Open up the XML view for the report, either in Visual Studio by right clicking the report and selecting View Code, or by editing in any text editor.
  2. Comment out Code. blocks. Ctrl + F your way through the document looking for Code.. The goal is to preserve the code in some way, while temporarily commenting out the line. Depending on your actual code, this might be different, but I here's what I like to do:
    • Find:               =Code.
    • Replace With: ='Code.
  3. Go back to the Designer View and Copy and Paste the Tablix. You can do this by right clicking the top left corner of the tablix control:

  4. Go back to the XML View and reverse the find and replace
    • Find:                ='Code.
    • Replace With: =Code.

You should be all set!

Note: You cannot just copy the <tablix> block in the XML view after step 1 because it will create elements with the same exact name property

Alternatively, you can just add a comment AFTER your code like so:

'custom code comment

Then you can copy and paste it as normal, without having to remove your comment afterwards or comment out your code beforehand.

I encountered this issue, and I noticed that this bug occurred when there is a Code reference anywhere in the report, and is not limited to the copied fields.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!