Convert Report to be Landscape

Today I had to make a new report in HR.Net Document Explorer. Unfortunately version of HR.Net I’m using is buggy.

Every time you try to view a report preview, it crashes:

2014-11-03 00_54_03

Vizual claims that this error is because I’m running 64-bit OS, but their software is only supposed to work on 32-bit. But if I create a sub-report, I can run a preview on that. I think lousy coding standards are at fault here and nothing to do with 32/64-bit compatibility. And Vizual support just tries to make themselves look less bad.

Anyway, after some poking about, I have found a database table where these report definitions are stored as XML. And we can manipulate XML as we wish! One of the properties report XML-definition is <Orientation>. It is set to 1 for Portrait page layout and 2 for Landscape (I did compare different reports). So now all we have to do is replace this value in the database:

update [dbo].[OC_REPORTS_REPORTDEFINITIONS]
set DEFINITIONDATA = cast(REPLACE(cast(DEFINITIONDATA as nvarchar(max)), '1', '2') as ntext)
from [dbo].[OC_REPORTS_REPORTDEFINITIONS] repdef
   inner join OC_DOCUMENTS docs on repdef.DOCUMENTID = docs.DOCUMENTID
where docs.DOCUMENTNAME = 'My Report Name'

Replace “My Report Name” with name of your report. Before running this query, please make a copy of your report – there is no guarantee that this will work, also there is a chance that your report might be messed up beyond recognition.

Also if you have sub-reports, they also will become Landscape. If this is your goal, then no problem. If not, you’ll have to go through all sub-reports and modify them back – you are in luck here. Document Console allows to modify the sub-report orientation without throwing errors.

This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

5 Responses to Convert Report to be Landscape

Leave a Reply

Your email address will not be published. Required fields are marked *