Hi,
I have created a multi-page report. I want to display a text box on each
page of the report. How to do so?
Note that I cannot make the text box as a part of data region (like list).
Its a kind of header information that need to be outputed in each page.
I cannot place the text box in header of the page since it takes value from
a database field. The header doesn't accept database fields.
regards,
Sachin.I think this is a difficult thing to do. One approach is to ensure that a
database field in a textbox is on each page of the report body. You may
then reference the textbox in the headder or footer with the ReportItems!
collection. We have reports that extend multiple pages when exported to PDF
format. I tried making a really tall and narrow textbox and this would work
for the first two pages, but when the matrix at the bottom of the report
grew onto a third page, the third page would not have a textbox and the
reference would be empty.
We took another approach, we passed in the ReportItems collection to a
custom assembly and kept a 'last known good' reference to it. We would then
call this method on each page and retrieve the last known good. I had to
pass in the whole ReportItems collection because passing in just the report
item would result in an #Error for pages that didn't contain the hidden text
box. From what I can tell all references in an expression are resolved
which is why I passed the collection. I think this would also work in code
behind without the custom assembly, but haven't tried it.
Hidden textbox in report body:
txtSchoolNameHidden
=First(Fields!OrganizationName.Value, "GetOrgInfo")
Expression in footer:
=Code.loc.SchoolName(ReportItems)
Code in Custom Assembly (because we are using a property, had to create an
instance, rather than static method)
private string _SchoolName;
public string
SchoolName(Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.ReportItems
input)
{
string ReturnVal = null;
try
{
Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.ReportItem
rptItemSchoolNameHidden = null;
rptItemSchoolNameHidden = input["txtSchoolNameHidden"];
if (rptItemSchoolNameHidden != null)
{
_SchoolName = rptItemSchoolNameHidden.Value.ToString();
}
}
catch
{
//ignore report item not found error.
}
return _SchoolName;
}
Seems like a lot of work for something simple. Any other ideas would be
appreciated.
Aaarrrghhh! Runs fine in SSRS2005 web window, when I export it to PDF only
the first page has my database field in the footer.
Steve MunLeeuw
"Sachin Laddha" <SachinLaddha@.discussions.microsoft.com> wrote in message
news:6866232F-21F1-42BB-A593-FCD33A2BE344@.microsoft.com...
> Hi,
> I have created a multi-page report. I want to display a text box on each
> page of the report. How to do so?
> Note that I cannot make the text box as a part of data region (like list).
> Its a kind of header information that need to be outputed in each page.
> I cannot place the text box in header of the page since it takes value
> from
> a database field. The header doesn't accept database fields.
> regards,
> Sachin.
>|||A text box can't take a database field directly in the header or footer, but
it can take a report parameter. That parameter in turn can be filled with
the value of a field in a dataset.
"Sachin Laddha" <SachinLaddha@.discussions.microsoft.com> wrote in message
news:6866232F-21F1-42BB-A593-FCD33A2BE344@.microsoft.com...
> Hi,
> I have created a multi-page report. I want to display a text box on each
> page of the report. How to do so?
> Note that I cannot make the text box as a part of data region (like list).
> Its a kind of header information that need to be outputed in each page.
> I cannot place the text box in header of the page since it takes value
> from
> a database field. The header doesn't accept database fields.
> regards,
> Sachin.
>|||I put a call to a custom assembly in a textbox expression in the footer.
When I appendend a counter for each call I was suprised to find the first
page expression was getting called 6 times, then one additional time for
each page when exported to PDF. I didn't go back and do the comparison for
the browser view with interactive height, and therefore different number of
pages as pdf.
The following code works.
static string _SchoolName;
public string
SchoolName(Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.ReportItems
input)
{
string ReturnVal = null;
try
{
Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.ReportItem
rptItemSchoolNameHidden = null;
rptItemSchoolNameHidden = input["txtSchoolNameHidden"];
if (rptItemSchoolNameHidden != null)
{
if (rptItemSchoolNameHidden.Value.ToString().Length > 0)
{
_SchoolName = rptItemSchoolNameHidden.Value.ToString();
}
}
}
catch
{
//ignore report item not found error.
}
return _SchoolName;
}
"Steve MunLeeuw" <smunson@.clearwire.net> wrote in message
news:ORGfb5LNGHA.2300@.TK2MSFTNGP15.phx.gbl...
>I think this is a difficult thing to do. One approach is to ensure that a
>database field in a textbox is on each page of the report body. You may
>then reference the textbox in the headder or footer with the ReportItems!
>collection. We have reports that extend multiple pages when exported to
>PDF format. I tried making a really tall and narrow textbox and this would
>work for the first two pages, but when the matrix at the bottom of the
>report grew onto a third page, the third page would not have a textbox and
>the reference would be empty.
> We took another approach, we passed in the ReportItems collection to a
> custom assembly and kept a 'last known good' reference to it. We would
> then call this method on each page and retrieve the last known good. I
> had to pass in the whole ReportItems collection because passing in just
> the report item would result in an #Error for pages that didn't contain
> the hidden text box. From what I can tell all references in an expression
> are resolved which is why I passed the collection. I think this would
> also work in code behind without the custom assembly, but haven't tried
> it.
> Hidden textbox in report body:
> txtSchoolNameHidden
> =First(Fields!OrganizationName.Value, "GetOrgInfo")
> Expression in footer:
> =Code.loc.SchoolName(ReportItems)
>
> Code in Custom Assembly (because we are using a property, had to create an
> instance, rather than static method)
> private string _SchoolName;
> public string
> SchoolName(Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.ReportItems
> input)
> {
> string ReturnVal = null;
> try
> {
> Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.ReportItem
> rptItemSchoolNameHidden = null;
> rptItemSchoolNameHidden = input["txtSchoolNameHidden"];
> if (rptItemSchoolNameHidden != null)
> {
> _SchoolName = rptItemSchoolNameHidden.Value.ToString();
> }
> }
> catch
> {
> //ignore report item not found error.
> }
> return _SchoolName;
> }
>
> Seems like a lot of work for something simple. Any other ideas would be
> appreciated.
> Aaarrrghhh! Runs fine in SSRS2005 web window, when I export it to PDF
> only the first page has my database field in the footer.
>
>
> Steve MunLeeuw
>
>
> "Sachin Laddha" <SachinLaddha@.discussions.microsoft.com> wrote in message
> news:6866232F-21F1-42BB-A593-FCD33A2BE344@.microsoft.com...
>> Hi,
>> I have created a multi-page report. I want to display a text box on each
>> page of the report. How to do so?
>> Note that I cannot make the text box as a part of data region (like
>> list).
>> Its a kind of header information that need to be outputed in each page.
>> I cannot place the text box in header of the page since it takes value
>> from
>> a database field. The header doesn't accept database fields.
>> regards,
>> Sachin.
>|||The parameter technique is better, I will use that.
"Steve MunLeeuw" <smunson@.clearwire.net> wrote in message
news:ORGfb5LNGHA.2300@.TK2MSFTNGP15.phx.gbl...
>I think this is a difficult thing to do. One approach is to ensure that a
>database field in a textbox is on each page of the report body. You may
>then reference the textbox in the headder or footer with the ReportItems!
>collection. We have reports that extend multiple pages when exported to
>PDF format. I tried making a really tall and narrow textbox and this would
>work for the first two pages, but when the matrix at the bottom of the
>report grew onto a third page, the third page would not have a textbox and
>the reference would be empty.
> We took another approach, we passed in the ReportItems collection to a
> custom assembly and kept a 'last known good' reference to it. We would
> then call this method on each page and retrieve the last known good. I
> had to pass in the whole ReportItems collection because passing in just
> the report item would result in an #Error for pages that didn't contain
> the hidden text box. From what I can tell all references in an expression
> are resolved which is why I passed the collection. I think this would
> also work in code behind without the custom assembly, but haven't tried
> it.
> Hidden textbox in report body:
> txtSchoolNameHidden
> =First(Fields!OrganizationName.Value, "GetOrgInfo")
> Expression in footer:
> =Code.loc.SchoolName(ReportItems)
>
> Code in Custom Assembly (because we are using a property, had to create an
> instance, rather than static method)
> private string _SchoolName;
> public string
> SchoolName(Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.ReportItems
> input)
> {
> string ReturnVal = null;
> try
> {
> Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.ReportItem
> rptItemSchoolNameHidden = null;
> rptItemSchoolNameHidden = input["txtSchoolNameHidden"];
> if (rptItemSchoolNameHidden != null)
> {
> _SchoolName = rptItemSchoolNameHidden.Value.ToString();
> }
> }
> catch
> {
> //ignore report item not found error.
> }
> return _SchoolName;
> }
>
> Seems like a lot of work for something simple. Any other ideas would be
> appreciated.
> Aaarrrghhh! Runs fine in SSRS2005 web window, when I export it to PDF
> only the first page has my database field in the footer.
>
>
> Steve MunLeeuw
>
>
> "Sachin Laddha" <SachinLaddha@.discussions.microsoft.com> wrote in message
> news:6866232F-21F1-42BB-A593-FCD33A2BE344@.microsoft.com...
>> Hi,
>> I have created a multi-page report. I want to display a text box on each
>> page of the report. How to do so?
>> Note that I cannot make the text box as a part of data region (like
>> list).
>> Its a kind of header information that need to be outputed in each page.
>> I cannot place the text box in header of the page since it takes value
>> from
>> a database field. The header doesn't accept database fields.
>> regards,
>> Sachin.
>
No comments:
Post a Comment