Showing posts with label paste. Show all posts
Showing posts with label paste. Show all posts

Wednesday, March 28, 2012

Images not being displayed.

1. I am using the webservice to render the images from a report, and they dont render.

I paste this URL to the browser

http://agamenon:90/ReportServer?%2fGescomRpts%2fRPT_MediosDesarrollo&rs%3aFormat=HTML4.0&rs:ImageID=6c809239-753f-4988-abcf-231416dff0d6

and I get this

No se encuentra la secuencia. No se encuentra el identificador de secuencia proporcionado a una operación en la base de datos del servidor de informes. (rsStreamNotFound) Obtener ayuda en pantalla

This is the code

the problem is that I need to know the streamid, and to know the streamid I first have to render the report where the image is to be placed.

This is the page getimage.aspx

protected void Page_Load(object sender, EventArgs e)

{

string reportPath = Server.UrlDecode(Request["report"]);

//string streamID = Request["streamid"];

ReportExecutionService rs = (ReportExecutionService)Session["rs"];

DataSourceCredentials[] credentials = null;

string showHideToggle = null;

string encoding;

string mimeType;

string extension;

Warning[] warnings = null;

ParameterValue[] reportHistoryParameters = null;

string historyID = null;

string[] streamIDs = null;

ServerInfoHeader sh = new ServerInfoHeader();

rs.ServerInfoHeaderValue = sh;

byte[] result = null;

ParameterValue[] reportParameterValues2 = null;

string deviceInfo = "<DeviceInfo>" +

//"<StreamRoot>" + streamRoot + "</StreamRoot>" +

"<Toolbar>False</Toolbar>" +

"<Parameters>False</Parameters>" +

"<HTMLFragment>True</HTMLFragment>" +

"<StyleStream>False</StyleStream>" +

"<Section>0</Section>" +

"<Zoom>" +

"</Zoom>" +

"</DeviceInfo>";

result = rs.Render("HTML4.0", deviceInfo, out extension, out mimeType, out encoding, out warnings, out streamIDs);

string streamID = streamIDs[0];

string encodingImage;

string mimeTypeImage;

byte[] image;

ParameterValue[] pv = (ParameterValue[])Session["reportParameterValues"];

//image = rs.RenderStream(reportPath, "HTML4.0", streamID, null, null, pv, out encodingImage, out mimeTypeImage);

image=rs.RenderStream("HTML4.0", streamID, null, out encodingImage, out mimeTypeImage);

Response.Clear();

Response.ContentType = mimeTypeImage;

Response.AppendHeader("content-length", image.Length.ToString());

Response.BinaryWrite(image);

Response.Flush();

Response.Close();

}

and this is the page of the report. Sorry for the long code.

if (reportCanBeRendered)

{

string deviceInfo;

string streamRoot;

Session["rs"] = rs;

streamRoot = ("getimage.aspx?report="+ (path + "&streamid="));

switch (format)

{

case "HTML4.0":

case "HTML3.2":

deviceInfo = "<DeviceInfo>" +

"<StreamRoot></StreamRoot>" +

"<Toolbar>False</Toolbar>" +

"<Parameters>False</Parameters>" +

"<HTMLFragment>True</HTMLFragment>" +

"<StyleStream>False</StyleStream>" +

"<Section>0</Section>" +

"<Zoom>" +

"</Zoom>" +

"</DeviceInfo>";

break;

default:

deviceInfo = "<DeviceInfo></DeviceInfo>";

break;

}

// SQLRS-ReportViewer

if (!(reportParameterValues == null))

{

//reportParameterValues2 = reportParameterValues.ToArray(typeof(ParameterValue));

//reportParameterValues2 = (ParameterValue[])reportParameterValues.ToArray(typeof(ParameterValue));

}

DataSourceCredentials[] credentials = null;

string showHideToggle = null;

string encoding;

string mimeType;

string extension;

Warning[] warnings = null;

ParameterValue[] reportHistoryParameters = null;

string historyID = null;

string[] streamIDs = null;

ServerInfoHeader sh = new ServerInfoHeader();

rs.ServerInfoHeaderValue = sh;

byte[] result = null;

ParameterValue[] reportParameterValues2 = null;

result = rs.Render(format, deviceInfo, out extension, out mimeType, out encoding, out warnings, out streamIDs);

streamRoot = "getimage.aspx?report=" + path + "&amp;streamid=" + streamIDs[0];

//string reportPath2 = Server.UrlDecode(Request["report"]);

//string streamID = streamIDs[0];

////string streamID = "";

//ReportExecutionService rs2 = new ReportExecutionService();

//Session["rs"] = rs;

//rs2=(ReportExecutionService)Session["rs"];

//////ReportingService rs = (ReportingService)Session["rs"];

//string encodingImage;

//string mimeTypeImage;

//byte[] image;

//ParameterValue[] pv = (ParameterValue[])Session["reportParameterValues"];

//////image = rs.RenderStream(reportPath, "HTML4.0", streamID, null, null, pv, out encodingImage, out mimeTypeImage);

//image = rs2.RenderStream("HTML4.0", streamID, null, out encodingImage, out mimeTypeImage);

//Response.Clear();

//Response.ContentType = mimeTypeImage;

//Response.AppendHeader("content-length", image.Length.ToString());

//Response.BinaryWrite(image);

//Response.Flush();

//Response.Close();

// store ReportingServices and parameters object is session layer in case we need it for image streams

Session["rs"] = rs;

Session["reportParameterValues"] = reportParameterValues2;

switch (format)

{

case "HTML4.0":

case "HTML3.2":

System.Text.Encoding enc = System.Text.Encoding.UTF8;

// get the report as a string

string tmpReport = enc.GetString(result);

// replace all occurrences of report server link with current page link

tmpReport = tmpReport.Replace(reportServerURL.Replace("/ReportService.asmx", "?"), ("http://"

+ (Request["SERVER_NAME"]

+ (Request["SCRIPT_NAME"] + "?Report="))));

ReportPlaceholder.InnerHtml = tmpReport;

break;

default:

Response.ClearContent();

Response.AppendHeader("content-length", result.Length.ToString());

Response.ContentType = mimeType;

Response.BinaryWrite(result);

Response.Flush();

Response.Close();

break;

}

}

I actually solved the proble, this code has a little of garbage, but it began working.

private void GenerarInPlaceHTML()

{

string path = reportPath+ "RPT_MediosDesarrollo";

ReportExecutionService rs = new ReportExecutionService();

rs.Url = reportServerURL;

System.Net.NetworkCredential reportCredentials = new System.Net.NetworkCredential(reportUser, userPassword, domain);

rs.Credentials = reportCredentials;

// see if Report URL parameter is defined and if it is then consider that report

if (!(Request["Report"] == null))

{

reportPath = Request["Report"];

}

// set the Report hidden parameter

Report.Value = reportPath;

// Get the list of parameters. without specifing to render the report (ForRendering set to false)

// valid values for these parameters will not be populated

ExecutionInfo execInfo;

execInfo = rs.LoadReport(path, null);

ReportParameter[] reportParametersArray = execInfo.Parameters;

//reportParametersArray = rs.GetReportParameters(path, null, false, null, null);

//// If there are parametrs then we generate an array with values that should be populated from either

//// - previous submission ,

//// - URL parameters,

//// - default value defined inside the report

//// some usefull declarations

System.Web.UI.HtmlControls.HtmlTableRow TR = new HtmlTableRow();

System.Web.UI.HtmlControls.HtmlTableCell TD;

System.Web.UI.HtmlControls.HtmlSelect S;

System.Web.UI.WebControls.ListItem LI;

System.Web.UI.HtmlControls.HtmlInputText T;

//// hash table with dependecies

System.Collections.Hashtable Dependencies = new System.Collections.Hashtable();

//// we need a dynamic array for storing parameter values

ArrayList reportParameterValues= new ArrayList();

if (reportCanBeRendered)

{

string deviceInfo;

string streamRoot;

Session["rs"] = rs;

streamRoot = ("getimage.aspx?report="+ (path + "&streamid="));

switch (format)

{

case "HTML4.0":

case "HTML3.2":

deviceInfo = "<DeviceInfo>" +

"<StreamRoot>http://ImagenesTemporales/</StreamRoot>" +

"<Toolbar>False</Toolbar>" +

"<Parameters>False</Parameters>" +

"<HTMLFragment>True</HTMLFragment>" +

"<StyleStream>False</StyleStream>" +

"<Section>0</Section>" +

"<Zoom>" +

"</Zoom>" +

"</DeviceInfo>";

break;

default:

deviceInfo = "<DeviceInfo></DeviceInfo>";

break;

}

// SQLRS-ReportViewer

if (!(reportParameterValues == null))

{

//reportParameterValues2 = reportParameterValues.ToArray(typeof(ParameterValue));

//reportParameterValues2 = (ParameterValue[])reportParameterValues.ToArray(typeof(ParameterValue));

}

DataSourceCredentials[] credentials = null;

string showHideToggle = null;

string encoding;

string mimeType;

string extension;

Warning[] warnings = null;

ParameterValue[] reportHistoryParameters = null;

string historyID = null;

string[] streamIDs = null;

ServerInfoHeader sh = new ServerInfoHeader();

rs.ServerInfoHeaderValue = sh;

byte[] result = null;

ParameterValue[] reportParameterValues2 = null;

result = rs.Render(format, deviceInfo, out extension, out mimeType, out encoding, out warnings, out streamIDs);

string encodingImage;

string mimeTypeImage;

byte[] image = rs.RenderStream("HTML4.0", streamIDs[0], null, out encodingImage,out mimeTypeImage);

System.IO.FileStream fs = System.IO.File.OpenWrite(@."C:\Inetpub\wwwroot\GescomDllo\ImagenesTemporales\" + streamIDs[0]);

fs.Write(image, 0, Convert.ToInt32(image.Length));

fs.Close();

// store ReportingServices and parameters object is session layer in case we need it for image streams

Session["rs"] = rs;

Session["reportParameterValues"] = reportParameterValues2;

switch (format)

{

case "HTML4.0":

case "HTML3.2":

System.Text.Encoding enc = System.Text.Encoding.UTF8;

// get the report as a string

string tmpReport = enc.GetString(result);

// replace all occurrences of report server link with current page link

tmpReport = tmpReport.Replace(reportServerURL.Replace("/ReportService.asmx", "?"), ("http://"

+ (Request["SERVER_NAME"]

+ (Request["SCRIPT_NAME"] + "?Report="))));

ReportPlaceholder.InnerHtml = tmpReport;

break;

default:

Response.ClearContent();

Response.AppendHeader("content-length", result.Length.ToString());

Response.ContentType = mimeType;

Response.BinaryWrite(result);

Response.Flush();

Response.Close();

break;

}

}

}

|||

Thanks buddy!!!

you answer helped me, though it was tough to figure out what i was doing wrong previosly. the only mistake i was doing is here .

it should be this.

image=rs.RenderStream("HTML4.0", streamID, null, out encodingImage, out mimeTypeImage);

i was doing this.

image=rs.RenderStream("IMAGE", streamID, null, out encodingImage, out mimeTypeImage);

Thanks again

|||

Luis Esteban, tendras ese mismo codigo pero para reporting services 2000?

Saludos

Images not being displayed.

1. I am using the webservice to render the images from a report, and they dont render.

I paste this URL to the browser

http://agamenon:90/ReportServer?%2fGescomRpts%2fRPT_MediosDesarrollo&rs%3aFormat=HTML4.0&rs:ImageID=6c809239-753f-4988-abcf-231416dff0d6

and I get this

No se encuentra la secuencia. No se encuentra el identificador de secuencia proporcionado a una operación en la base de datos del servidor de informes. (rsStreamNotFound) Obtener ayuda en pantalla

This is the code

the problem is that I need to know the streamid, and to know the streamid I first have to render the report where the image is to be placed.

This is the page getimage.aspx

protectedvoid Page_Load(object sender, EventArgs e)

{

string reportPath = Server.UrlDecode(Request["report"]);

//string streamID = Request["streamid"];

ReportExecutionService rs = (ReportExecutionService)Session["rs"];

DataSourceCredentials[] credentials = null;

string showHideToggle = null;

string encoding;

string mimeType;

string extension;

Warning[] warnings = null;

ParameterValue[] reportHistoryParameters = null;

string historyID = null;

string[] streamIDs = null;

ServerInfoHeader sh = newServerInfoHeader();

rs.ServerInfoHeaderValue = sh;

byte[] result = null;

ParameterValue[] reportParameterValues2 = null;

string deviceInfo = "<DeviceInfo>" +

//"<StreamRoot>" + streamRoot + "</StreamRoot>" +

"<Toolbar>False</Toolbar>" +

"<Parameters>False</Parameters>" +

"<HTMLFragment>True</HTMLFragment>" +

"<StyleStream>False</StyleStream>" +

"<Section>0</Section>" +

"<Zoom>" +

"</Zoom>" +

"</DeviceInfo>";

result = rs.Render("HTML4.0", deviceInfo, out extension, out mimeType, out encoding, out warnings, out streamIDs);

string streamID = streamIDs[0];

string encodingImage;

string mimeTypeImage;

byte[] image;

ParameterValue[] pv = (ParameterValue[])Session["reportParameterValues"];

//image = rs.RenderStream(reportPath, "HTML4.0", streamID, null, null, pv, out encodingImage, out mimeTypeImage);

image=rs.RenderStream("HTML4.0", streamID, null, out encodingImage, out mimeTypeImage);

Response.Clear();

Response.ContentType = mimeTypeImage;

Response.AppendHeader("content-length", image.Length.ToString());

Response.BinaryWrite(image);

Response.Flush();

Response.Close();

}

and this is the page of the report. Sorry for the long code.

if (reportCanBeRendered)

{

string deviceInfo;

string streamRoot;

Session["rs"] = rs;

streamRoot = ("getimage.aspx?report="+ (path + "&streamid="));

switch (format)

{

case"HTML4.0":

case"HTML3.2":

deviceInfo = "<DeviceInfo>" +

"<StreamRoot></StreamRoot>" +

"<Toolbar>False</Toolbar>" +

"<Parameters>False</Parameters>" +

"<HTMLFragment>True</HTMLFragment>" +

"<StyleStream>False</StyleStream>" +

"<Section>0</Section>" +

"<Zoom>" +

"</Zoom>" +

"</DeviceInfo>";

break;

default:

deviceInfo = "<DeviceInfo></DeviceInfo>";

break;

}

// SQLRS-ReportViewer

if (!(reportParameterValues == null))

{

//reportParameterValues2 = reportParameterValues.ToArray(typeof(ParameterValue));

//reportParameterValues2 = (ParameterValue[])reportParameterValues.ToArray(typeof(ParameterValue));

}

DataSourceCredentials[] credentials = null;

string showHideToggle = null;

string encoding;

string mimeType;

string extension;

Warning[] warnings = null;

ParameterValue[] reportHistoryParameters = null;

string historyID = null;

string[] streamIDs = null;

ServerInfoHeader sh = newServerInfoHeader();

rs.ServerInfoHeaderValue = sh;

byte[] result = null;

ParameterValue[] reportParameterValues2 = null;

result = rs.Render(format, deviceInfo, out extension, out mimeType, out encoding, out warnings, out streamIDs);

streamRoot = "getimage.aspx?report=" + path + "&amp;streamid=" + streamIDs[0];

//string reportPath2 = Server.UrlDecode(Request["report"]);

//string streamID = streamIDs[0];

////string streamID = "";

//ReportExecutionService rs2 = new ReportExecutionService();

//Session["rs"] = rs;

//rs2=(ReportExecutionService)Session["rs"];

//////ReportingService rs = (ReportingService)Session["rs"];

//string encodingImage;

//string mimeTypeImage;

//byte[] image;

//ParameterValue[] pv = (ParameterValue[])Session["reportParameterValues"];

//////image = rs.RenderStream(reportPath, "HTML4.0", streamID, null, null, pv, out encodingImage, out mimeTypeImage);

//image = rs2.RenderStream("HTML4.0", streamID, null, out encodingImage, out mimeTypeImage);

//Response.Clear();

//Response.ContentType = mimeTypeImage;

//Response.AppendHeader("content-length", image.Length.ToString());

//Response.BinaryWrite(image);

//Response.Flush();

//Response.Close();

// store ReportingServices and parameters object is session layer in case we need it for image streams

Session["rs"] = rs;

Session["reportParameterValues"] = reportParameterValues2;

switch (format)

{

case"HTML4.0":

case"HTML3.2":

System.Text.Encoding enc = System.Text.Encoding.UTF8;

// get the report as a string

string tmpReport = enc.GetString(result);

// replace all occurrences of report server link with current page link

tmpReport = tmpReport.Replace(reportServerURL.Replace("/ReportService.asmx", "?"), ("http://"

+ (Request["SERVER_NAME"]

+ (Request["SCRIPT_NAME"] + "?Report="))));

ReportPlaceholder.InnerHtml = tmpReport;

break;

default:

Response.ClearContent();

Response.AppendHeader("content-length", result.Length.ToString());

Response.ContentType = mimeType;

Response.BinaryWrite(result);

Response.Flush();

Response.Close();

break;

}

}

I actually solved the proble, this code has a little of garbage, but it began working.

privatevoid GenerarInPlaceHTML()

{

string path = reportPath+ "RPT_MediosDesarrollo";

ReportExecutionService rs = newReportExecutionService();

rs.Url = reportServerURL;

System.Net.NetworkCredential reportCredentials = new System.Net.NetworkCredential(reportUser, userPassword, domain);

rs.Credentials = reportCredentials;

// see if Report URL parameter is defined and if it is then consider that report

if (!(Request["Report"] == null))

{

reportPath = Request["Report"];

}

// set the Report hidden parameter

Report.Value = reportPath;

// Get the list of parameters. without specifing to render the report (ForRendering set to false)

// valid values for these parameters will not be populated

ExecutionInfo execInfo;

execInfo = rs.LoadReport(path, null);

ReportParameter[] reportParametersArray = execInfo.Parameters;

//reportParametersArray = rs.GetReportParameters(path, null, false, null, null);

//// If there are parametrs then we generate an array with values that should be populated from either

//// - previous submission ,

//// - URL parameters,

//// - default value defined inside the report

//// some usefull declarations

System.Web.UI.HtmlControls.HtmlTableRow TR = newHtmlTableRow();

System.Web.UI.HtmlControls.HtmlTableCell TD;

System.Web.UI.HtmlControls.HtmlSelect S;

System.Web.UI.WebControls.ListItem LI;

System.Web.UI.HtmlControls.HtmlInputText T;

//// hash table with dependecies

System.Collections.Hashtable Dependencies = new System.Collections.Hashtable();

//// we need a dynamic array for storing parameter values

ArrayList reportParameterValues= newArrayList();

if (reportCanBeRendered)

{

string deviceInfo;

string streamRoot;

Session["rs"] = rs;

streamRoot = ("getimage.aspx?report="+ (path + "&streamid="));

switch (format)

{

case"HTML4.0":

case"HTML3.2":

deviceInfo = "<DeviceInfo>" +

"<StreamRoot>http://ImagenesTemporales/</StreamRoot>" +

"<Toolbar>False</Toolbar>" +

"<Parameters>False</Parameters>" +

"<HTMLFragment>True</HTMLFragment>" +

"<StyleStream>False</StyleStream>" +

"<Section>0</Section>" +

"<Zoom>" +

"</Zoom>" +

"</DeviceInfo>";

break;

default:

deviceInfo = "<DeviceInfo></DeviceInfo>";

break;

}

// SQLRS-ReportViewer

if (!(reportParameterValues == null))

{

//reportParameterValues2 = reportParameterValues.ToArray(typeof(ParameterValue));

//reportParameterValues2 = (ParameterValue[])reportParameterValues.ToArray(typeof(ParameterValue));

}

DataSourceCredentials[] credentials = null;

string showHideToggle = null;

string encoding;

string mimeType;

string extension;

Warning[] warnings = null;

ParameterValue[] reportHistoryParameters = null;

string historyID = null;

string[] streamIDs = null;

ServerInfoHeader sh = newServerInfoHeader();

rs.ServerInfoHeaderValue = sh;

byte[] result = null;

ParameterValue[] reportParameterValues2 = null;

result = rs.Render(format, deviceInfo, out extension, out mimeType, out encoding, out warnings, out streamIDs);

string encodingImage;

string mimeTypeImage;

byte[] image = rs.RenderStream("HTML4.0", streamIDs[0], null, out encodingImage,out mimeTypeImage);

System.IO.FileStream fs = System.IO.File.OpenWrite(@."C:\Inetpub\wwwroot\GescomDllo\ImagenesTemporales\" + streamIDs[0]);

fs.Write(image, 0, Convert.ToInt32(image.Length));

fs.Close();

// store ReportingServices and parameters object is session layer in case we need it for image streams

Session["rs"] = rs;

Session["reportParameterValues"] = reportParameterValues2;

switch (format)

{

case"HTML4.0":

case"HTML3.2":

System.Text.Encoding enc = System.Text.Encoding.UTF8;

// get the report as a string

string tmpReport = enc.GetString(result);

// replace all occurrences of report server link with current page link

tmpReport = tmpReport.Replace(reportServerURL.Replace("/ReportService.asmx", "?"), ("http://"

+ (Request["SERVER_NAME"]

+ (Request["SCRIPT_NAME"] + "?Report="))));

ReportPlaceholder.InnerHtml = tmpReport;

break;

default:

Response.ClearContent();

Response.AppendHeader("content-length", result.Length.ToString());

Response.ContentType = mimeType;

Response.BinaryWrite(result);

Response.Flush();

Response.Close();

break;

}

}

}

|||

Thanks buddy!!!

you answer helped me, though it was tough to figure out what i was doing wrong previosly. the only mistake i was doing is here .

it should be this.

image=rs.RenderStream("HTML4.0", streamID, null, out encodingImage, out mimeTypeImage);

i was doing this.

image=rs.RenderStream("IMAGE", streamID, null, out encodingImage, out mimeTypeImage);

Thanks again

|||

Luis Esteban, tendras ese mismo codigo pero para reporting services 2000?

Saludos

Images not being displayed.

1. I am using the webservice to render the images from a report, and they dont render.

I paste this URL to the browser

http://agamenon:90/ReportServer?%2fGescomRpts%2fRPT_MediosDesarrollo&rs%3aFormat=HTML4.0&rs:ImageID=6c809239-753f-4988-abcf-231416dff0d6

and I get this

No se encuentra la secuencia. No se encuentra el identificador de secuencia proporcionado a una operación en la base de datos del servidor de informes. (rsStreamNotFound) Obtener ayuda en pantalla

This is the code

the problem is that I need to know the streamid, and to know the streamid I first have to render the report where the image is to be placed.

This is the page getimage.aspx

protected void Page_Load(object sender, EventArgs e)

{

string reportPath = Server.UrlDecode(Request["report"]);

//string streamID = Request["streamid"];

ReportExecutionService rs = (ReportExecutionService)Session["rs"];

DataSourceCredentials[] credentials = null;

string showHideToggle = null;

string encoding;

string mimeType;

string extension;

Warning[] warnings = null;

ParameterValue[] reportHistoryParameters = null;

string historyID = null;

string[] streamIDs = null;

ServerInfoHeader sh = new ServerInfoHeader();

rs.ServerInfoHeaderValue = sh;

byte[] result = null;

ParameterValue[] reportParameterValues2 = null;

string deviceInfo = "<DeviceInfo>" +

//"<StreamRoot>" + streamRoot + "</StreamRoot>" +

"<Toolbar>False</Toolbar>" +

"<Parameters>False</Parameters>" +

"<HTMLFragment>True</HTMLFragment>" +

"<StyleStream>False</StyleStream>" +

"<Section>0</Section>" +

"<Zoom>" +

"</Zoom>" +

"</DeviceInfo>";

result = rs.Render("HTML4.0", deviceInfo, out extension, out mimeType, out encoding, out warnings, out streamIDs);

string streamID = streamIDs[0];

string encodingImage;

string mimeTypeImage;

byte[] image;

ParameterValue[] pv = (ParameterValue[])Session["reportParameterValues"];

//image = rs.RenderStream(reportPath, "HTML4.0", streamID, null, null, pv, out encodingImage, out mimeTypeImage);

image=rs.RenderStream("HTML4.0", streamID, null, out encodingImage, out mimeTypeImage);

Response.Clear();

Response.ContentType = mimeTypeImage;

Response.AppendHeader("content-length", image.Length.ToString());

Response.BinaryWrite(image);

Response.Flush();

Response.Close();

}

and this is the page of the report. Sorry for the long code.

if (reportCanBeRendered)

{

string deviceInfo;

string streamRoot;

Session["rs"] = rs;

streamRoot = ("getimage.aspx?report="+ (path + "&streamid="));

switch (format)

{

case "HTML4.0":

case "HTML3.2":

deviceInfo = "<DeviceInfo>" +

"<StreamRoot></StreamRoot>" +

"<Toolbar>False</Toolbar>" +

"<Parameters>False</Parameters>" +

"<HTMLFragment>True</HTMLFragment>" +

"<StyleStream>False</StyleStream>" +

"<Section>0</Section>" +

"<Zoom>" +

"</Zoom>" +

"</DeviceInfo>";

break;

default:

deviceInfo = "<DeviceInfo></DeviceInfo>";

break;

}

// SQLRS-ReportViewer

if (!(reportParameterValues == null))

{

//reportParameterValues2 = reportParameterValues.ToArray(typeof(ParameterValue));

//reportParameterValues2 = (ParameterValue[])reportParameterValues.ToArray(typeof(ParameterValue));

}

DataSourceCredentials[] credentials = null;

string showHideToggle = null;

string encoding;

string mimeType;

string extension;

Warning[] warnings = null;

ParameterValue[] reportHistoryParameters = null;

string historyID = null;

string[] streamIDs = null;

ServerInfoHeader sh = new ServerInfoHeader();

rs.ServerInfoHeaderValue = sh;

byte[] result = null;

ParameterValue[] reportParameterValues2 = null;

result = rs.Render(format, deviceInfo, out extension, out mimeType, out encoding, out warnings, out streamIDs);

streamRoot = "getimage.aspx?report=" + path + "&amp;streamid=" + streamIDs[0];

//string reportPath2 = Server.UrlDecode(Request["report"]);

//string streamID = streamIDs[0];

////string streamID = "";

//ReportExecutionService rs2 = new ReportExecutionService();

//Session["rs"] = rs;

//rs2=(ReportExecutionService)Session["rs"];

//////ReportingService rs = (ReportingService)Session["rs"];

//string encodingImage;

//string mimeTypeImage;

//byte[] image;

//ParameterValue[] pv = (ParameterValue[])Session["reportParameterValues"];

//////image = rs.RenderStream(reportPath, "HTML4.0", streamID, null, null, pv, out encodingImage, out mimeTypeImage);

//image = rs2.RenderStream("HTML4.0", streamID, null, out encodingImage, out mimeTypeImage);

//Response.Clear();

//Response.ContentType = mimeTypeImage;

//Response.AppendHeader("content-length", image.Length.ToString());

//Response.BinaryWrite(image);

//Response.Flush();

//Response.Close();

// store ReportingServices and parameters object is session layer in case we need it for image streams

Session["rs"] = rs;

Session["reportParameterValues"] = reportParameterValues2;

switch (format)

{

case "HTML4.0":

case "HTML3.2":

System.Text.Encoding enc = System.Text.Encoding.UTF8;

// get the report as a string

string tmpReport = enc.GetString(result);

// replace all occurrences of report server link with current page link

tmpReport = tmpReport.Replace(reportServerURL.Replace("/ReportService.asmx", "?"), ("http://"

+ (Request["SERVER_NAME"]

+ (Request["SCRIPT_NAME"] + "?Report="))));

ReportPlaceholder.InnerHtml = tmpReport;

break;

default:

Response.ClearContent();

Response.AppendHeader("content-length", result.Length.ToString());

Response.ContentType = mimeType;

Response.BinaryWrite(result);

Response.Flush();

Response.Close();

break;

}

}

I actually solved the proble, this code has a little of garbage, but it began working.

private void GenerarInPlaceHTML()

{

string path = reportPath+ "RPT_MediosDesarrollo";

ReportExecutionService rs = new ReportExecutionService();

rs.Url = reportServerURL;

System.Net.NetworkCredential reportCredentials = new System.Net.NetworkCredential(reportUser, userPassword, domain);

rs.Credentials = reportCredentials;

// see if Report URL parameter is defined and if it is then consider that report

if (!(Request["Report"] == null))

{

reportPath = Request["Report"];

}

// set the Report hidden parameter

Report.Value = reportPath;

// Get the list of parameters. without specifing to render the report (ForRendering set to false)

// valid values for these parameters will not be populated

ExecutionInfo execInfo;

execInfo = rs.LoadReport(path, null);

ReportParameter[] reportParametersArray = execInfo.Parameters;

//reportParametersArray = rs.GetReportParameters(path, null, false, null, null);

//// If there are parametrs then we generate an array with values that should be populated from either

//// - previous submission ,

//// - URL parameters,

//// - default value defined inside the report

//// some usefull declarations

System.Web.UI.HtmlControls.HtmlTableRow TR = new HtmlTableRow();

System.Web.UI.HtmlControls.HtmlTableCell TD;

System.Web.UI.HtmlControls.HtmlSelect S;

System.Web.UI.WebControls.ListItem LI;

System.Web.UI.HtmlControls.HtmlInputText T;

//// hash table with dependecies

System.Collections.Hashtable Dependencies = new System.Collections.Hashtable();

//// we need a dynamic array for storing parameter values

ArrayList reportParameterValues= new ArrayList();

if (reportCanBeRendered)

{

string deviceInfo;

string streamRoot;

Session["rs"] = rs;

streamRoot = ("getimage.aspx?report="+ (path + "&streamid="));

switch (format)

{

case "HTML4.0":

case "HTML3.2":

deviceInfo = "<DeviceInfo>" +

"<StreamRoot>http://ImagenesTemporales/</StreamRoot>" +

"<Toolbar>False</Toolbar>" +

"<Parameters>False</Parameters>" +

"<HTMLFragment>True</HTMLFragment>" +

"<StyleStream>False</StyleStream>" +

"<Section>0</Section>" +

"<Zoom>" +

"</Zoom>" +

"</DeviceInfo>";

break;

default:

deviceInfo = "<DeviceInfo></DeviceInfo>";

break;

}

// SQLRS-ReportViewer

if (!(reportParameterValues == null))

{

//reportParameterValues2 = reportParameterValues.ToArray(typeof(ParameterValue));

//reportParameterValues2 = (ParameterValue[])reportParameterValues.ToArray(typeof(ParameterValue));

}

DataSourceCredentials[] credentials = null;

string showHideToggle = null;

string encoding;

string mimeType;

string extension;

Warning[] warnings = null;

ParameterValue[] reportHistoryParameters = null;

string historyID = null;

string[] streamIDs = null;

ServerInfoHeader sh = new ServerInfoHeader();

rs.ServerInfoHeaderValue = sh;

byte[] result = null;

ParameterValue[] reportParameterValues2 = null;

result = rs.Render(format, deviceInfo, out extension, out mimeType, out encoding, out warnings, out streamIDs);

string encodingImage;

string mimeTypeImage;

byte[] image = rs.RenderStream("HTML4.0", streamIDs[0], null, out encodingImage,out mimeTypeImage);

System.IO.FileStream fs = System.IO.File.OpenWrite(@."C:\Inetpub\wwwroot\GescomDllo\ImagenesTemporales\" + streamIDs[0]);

fs.Write(image, 0, Convert.ToInt32(image.Length));

fs.Close();

// store ReportingServices and parameters object is session layer in case we need it for image streams

Session["rs"] = rs;

Session["reportParameterValues"] = reportParameterValues2;

switch (format)

{

case "HTML4.0":

case "HTML3.2":

System.Text.Encoding enc = System.Text.Encoding.UTF8;

// get the report as a string

string tmpReport = enc.GetString(result);

// replace all occurrences of report server link with current page link

tmpReport = tmpReport.Replace(reportServerURL.Replace("/ReportService.asmx", "?"), ("http://"

+ (Request["SERVER_NAME"]

+ (Request["SCRIPT_NAME"] + "?Report="))));

ReportPlaceholder.InnerHtml = tmpReport;

break;

default:

Response.ClearContent();

Response.AppendHeader("content-length", result.Length.ToString());

Response.ContentType = mimeType;

Response.BinaryWrite(result);

Response.Flush();

Response.Close();

break;

}

}

}

|||

Thanks buddy!!!

you answer helped me, though it was tough to figure out what i was doing wrong previosly. the only mistake i was doing is here .

it should be this.

image=rs.RenderStream("HTML4.0", streamID, null, out encodingImage, out mimeTypeImage);

i was doing this.

image=rs.RenderStream("IMAGE", streamID, null, out encodingImage, out mimeTypeImage);

Thanks again

|||

Luis Esteban, tendras ese mismo codigo pero para reporting services 2000?

Saludos

sql

Monday, March 19, 2012

Image - Paste into table vs. Insert Object linked or unlinked

I have a form in which one of the columns will show a picture. Is there any
difference when using the form if I paste in the image or use "Insert
Object".
When looking at the underlying table after closing the form:
If the image is pasted, it shows "Picture" as the value in the field
If the image is put in via Insert Object and it is unlinked, it shows
"Package"
When I look at the "Bound Object Frame", I see no difference in values. I
see identical images when viewing the form.
My initial take on it is if the image won't change, go ahead and paste it
in. If the document may change, then it should be linked.
Is there a preferred method?
What program are you using?
Wei Xiao [MSFT]
SQL Server Storage Engine Development
http://weblogs.asp.net/weix
This posting is provided "AS IS" with no warranties, and confers no rights.
"Dkline" <Dkline001@.comcast.net> wrote in message
news:%23v1xUqpHFHA.1860@.TK2MSFTNGP15.phx.gbl...
>I have a form in which one of the columns will show a picture. Is there any
>difference when using the form if I paste in the image or use "Insert
>Object".
> When looking at the underlying table after closing the form:
> If the image is pasted, it shows "Picture" as the value in the field
> If the image is put in via Insert Object and it is unlinked, it shows
> "Package"
> When I look at the "Bound Object Frame", I see no difference in values. I
> see identical images when viewing the form.
> My initial take on it is if the image won't change, go ahead and paste it
> in. If the document may change, then it should be linked.
> Is there a preferred method?
>

Image - Paste into table vs. Insert Object linked or unlinked

I have a form in which one of the columns will show a picture. Is there any
difference when using the form if I paste in the image or use "Insert
Object".
When looking at the underlying table after closing the form:
If the image is pasted, it shows "Picture" as the value in the field
If the image is put in via Insert Object and it is unlinked, it shows
"Package"
When I look at the "Bound Object Frame", I see no difference in values. I
see identical images when viewing the form.
My initial take on it is if the image won't change, go ahead and paste it
in. If the document may change, then it should be linked.
Is there a preferred method?What program are you using?
Wei Xiao [MSFT]
SQL Server Storage Engine Development
http://weblogs.asp.net/weix
This posting is provided "AS IS" with no warranties, and confers no rights.
"Dkline" <Dkline001@.comcast.net> wrote in message
news:%23v1xUqpHFHA.1860@.TK2MSFTNGP15.phx.gbl...
>I have a form in which one of the columns will show a picture. Is there any
>difference when using the form if I paste in the image or use "Insert
>Object".
> When looking at the underlying table after closing the form:
> If the image is pasted, it shows "Picture" as the value in the field
> If the image is put in via Insert Object and it is unlinked, it shows
> "Package"
> When I look at the "Bound Object Frame", I see no difference in values. I
> see identical images when viewing the form.
> My initial take on it is if the image won't change, go ahead and paste it
> in. If the document may change, then it should be linked.
> Is there a preferred method?
>

Image - Paste into table vs. Insert Object linked or unlinked

I have a form in which one of the columns will show a picture. Is there any
difference when using the form if I paste in the image or use "Insert
Object".
When looking at the underlying table after closing the form:
If the image is pasted, it shows "Picture" as the value in the field
If the image is put in via Insert Object and it is unlinked, it shows
"Package"
When I look at the "Bound Object Frame", I see no difference in values. I
see identical images when viewing the form.
My initial take on it is if the image won't change, go ahead and paste it
in. If the document may change, then it should be linked.
Is there a preferred method?What program are you using?
--
Wei Xiao [MSFT]
SQL Server Storage Engine Development
http://weblogs.asp.net/weix
This posting is provided "AS IS" with no warranties, and confers no rights.
"Dkline" <Dkline001@.comcast.net> wrote in message
news:%23v1xUqpHFHA.1860@.TK2MSFTNGP15.phx.gbl...
>I have a form in which one of the columns will show a picture. Is there any
>difference when using the form if I paste in the image or use "Insert
>Object".
> When looking at the underlying table after closing the form:
> If the image is pasted, it shows "Picture" as the value in the field
> If the image is put in via Insert Object and it is unlinked, it shows
> "Package"
> When I look at the "Bound Object Frame", I see no difference in values. I
> see identical images when viewing the form.
> My initial take on it is if the image won't change, go ahead and paste it
> in. If the document may change, then it should be linked.
> Is there a preferred method?
>