Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Hyperlink TOC to report with ASP.NET
NickLewis
I've been using the actuate iserver api with .NET and have successfully brought back a report as well as a TOC. However the TOC only gives me the bookmark names (no page numbers) and I'm not sure how to hyperlink those to the report (PDF format) or user the TOC with the report at all. Has anyone had experience access the report in this way?
Thanks
Find more posts tagged with
Comments
averma
Hi NickLewis,
If you are grouping in your report, when you export to PDF it will automatically create bookmarks that will link to report data. Here is an sample of how you can implement TOC within a report:
http://www.birt-exchange.org/org/devshare/designing-birt-reports/1270-yet-another-report-with-a-printable-table-of-contents-(toc)/
Ashwini
NickLewis
Thanks for your response, I really appreciate it since I'm stuck on this problem and really new to this line of products. Unfortunately I don't have a lot of control on how the report is generated. I'm just displaying it in an existing .NET application using the iserver api and piecing the examples that came with that. Below is my code to pull the report back in PDF format and then the code to pull the TOC but I don't know what to do with the TOC response information to make it link to the report. It just gives me text of the chapters and an objid which I think is just a node id, but no page numbers. With page numbers I could link to the page but I can't find a way to even take that info and find a page number. Any thoughts would be appreciated?
Call Report:
ActuateAPI proxy = new ActuateAPI();
proxy.HeaderValue = new Header();
proxy.Url = "
http://reportserver"
;
// Prepare the login reqest parameters
Server_Proxy.localhost.Login loginRequest = new Server_Proxy.localhost.Login();
loginRequest.Password = "password";
loginRequest.User = "username";
// In case of multivolume encyclopedia, use the following element
// to determine which volume to connect to;
// request is forwarded to the default volume if no one specified
loginRequest.UserSetting = true;
loginRequest.UserSettingSpecified = true;
// Send reqest, handle SOAP exceptions if any
LoginResponse loginResponse;
try
{
loginResponse = proxy.login(loginRequest);
}
catch (Exception e_response)
{
throw e_response;
}
// Store the authentication id
proxy.HeaderValue.AuthId = loginResponse.AuthId;
GetContentResponse reportResponse = new GetContentResponse();
Server_Proxy.localhost.GetContent reportRequest = new GetContent();
Server_Proxy.localhost.ObjectIdentifier objectID = new ObjectIdentifier();
objectID.Name = "/reports/en_US/myreport.roi";
Server_Proxy.localhost.ViewParameter viewParams = new ViewParameter();
viewParams.Format = "PDF";
Server_Proxy.localhost.ComponentType componentType = new ComponentType();
componentType.Id = "0";
reportRequest.DownloadEmbedded = true;
reportRequest.Object = objectID;
reportRequest.ViewParameter = viewParams;
reportRequest.Component = componentType;
Server_Proxy.localhost.Attachment pdf = new Attachment();
reportResponse = proxy.getContent(reportRequest);
pdf = reportResponse.ContentRef;
if (pdf != null)
{
string strDate = DateTime.Now.Month.ToString() + "_" + DateTime.Now.Day.ToString() + "_" + DateTime.Now.Year.ToString();
Page.Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.Buffer = true;
Response.AppendHeader("Content-Disposition", "inline=" + strDate + ".pdf");
Response.AppendHeader("Content-Length", pdf.ContentData.Length.ToString());
Response.ContentType = "application/pdf";
Response.BinaryWrite(pdf.ContentData);
Response.Flush();
Response.Close();
Response.End();
}
GetTOC
ActuateAPI proxy = new ActuateAPI();
proxy.HeaderValue = new Header();
proxy.Url = "
http://reportserver"
;
// Prepare the login reqest parameters
Server_Proxy.localhost.Login loginRequest = new Server_Proxy.localhost.Login();
loginRequest.Password = "password";
loginRequest.User = "username";
// In case of multivolume encyclopedia, use the following element
// to determine which volume to connect to;
// request is forwarded to the default volume if no one specified
loginRequest.UserSetting = true;
loginRequest.UserSettingSpecified = true;
// Send reqest, handle SOAP exceptions if any
LoginResponse loginResponse;
try
{
loginResponse = proxy.login(loginRequest);
}
catch (Exception e_response)
{
throw e_response;
}
// Store the authentication id
proxy.HeaderValue.AuthId = loginResponse.AuthId;
GetTOCResponse tocResponse = new GetTOCResponse();
Server_Proxy.localhost.GetTOC tocRequest = new GetTOC();
Server_Proxy.localhost.ObjectIdentifier objectID = new ObjectIdentifier();
objectID.Name = "/reports/en_US/myreport.roi";
Server_Proxy.localhost.ViewParameter viewParams = new ViewParameter();
viewParams.Format = "XMLDisplay";
tocRequest.DownloadEmbedded = true;
tocRequest.Object = objectID;
tocRequest.ViewParameter = viewParams;
tocRequest.TocNodeId = "0";
tocRequest.Depth = "6";
Server_Proxy.localhost.Attachment toc = new Attachment();
tocResponse = proxy.getTOC(tocRequest);
toc = tocResponse.TocRef;
if (toc != null)
{
string strDate = DateTime.Now.Month.ToString() + "_" + DateTime.Now.Day.ToString() + "_" + DateTime.Now.Year.ToString();
Page.Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.Buffer = true;
//Response.AppendHeader("Content-Disposition", "filename=" + strDate + ".xml");
Response.AppendHeader("Content-Length", toc.ContentData.Length.ToString());
Response.ContentType = "text/xml";
Response.BinaryWrite(toc.ContentData);
Response.Flush();
Response.Close();
Response.End();
}
Toc Response:
<TOC>
<Node objid="149" expandable="1">
<Text>Details Report 2011</Text>
<Contents>
<Node objid="198" expandable="1">
<Text>TOP LEVEL</Text>
<Contents>
<Node objid="3978" expandable="1">
<Text>Chapter 1</Text>
</Node>
<Node objid="2777223" expandable="1">
<Text>Chapter 2</Text>
<Contents>
<Node objid="2780697" expandable="1">
<Text>Chapter 2.1</Text>
</Node>
</Contents>
</Node>
+ <Node objid="2880630" expandable="1">
+ <Node objid="3327848" expandable="1">
+ <Node objid="4243642" expandable="1">
+ <Node objid="4426768" expandable="1">
+ <Node objid="6782012" expandable="1">
</Contents>
</Node>
</Contents>
</Node>
</TOC>