We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose Txt

I am attempting to render a report using the Aspose txt. The report works on the report server and if I call ContentType = “application\pdf”, however, it renders a gobble gook text file if I use “text\plain” with extention .txt . Can you help? the code is below

Response.ContentType = "text\plain";
strExt = CEReports.CONST_EXTENSION_TYPE_TEXT;
strReportName = "/GLP Reports/FormNPX_Txt";
Response.AddHeader ("content-disposition", 
"attachment; filename=\"" + strFileName[2] + strExt + "\"");
// GenerateReport Function
Response.BinaryWrite(byteReportData);
Response.Flush();
Response.Close();

This message was posted using Page2Forum from Aspose.Words for Reporting Services Documentation - Aspose.Words for Reporting Services - Documentation

Hi,
Thank you for your request. Did you check the same report exported via the Report Manager? Does the exported file look as expected?
Thanks.

Another question is, how do you get the byte array you write to Response? Could you please post the code?

Yes, it works on the report server as expected.
here is the bytReportData, you are probably on to something. Originally it Format Type was excel, i changed it to Text and doesn’t work now. I may be using the wrong format type.

strFormat = "Excel" //tried Text doesn't work..
bytReportData = objReportingService.Render(strReportName, strFormat, null, null,
RepParamValues, objCredentials, string.Empty, out strEncoding, out strMimeType,
out reportHistoryParameters, out warnings, out strStreamIDs);
{
    string strReportServer = GetConfigSetting(ConstantsAndEnums._VOTE_REPORT_SERVER);
    pCryptographyLib objCryptographyLib = new pCryptographyLib();
    strReportServer = objCryptographyLib.DoDecryption(strReportServer);
    ReportingService objReportingService = new ReportingService(strReportServer);
    // Call the Reporting Web Service
    // Assign TimeOut property of the Web Service
    objReportingService.Timeout = Convert.ToInt32(GetConfigSetting(ConstantsAndEnums._VOTE_REPORT_SERVICE_TIMEOUT));
    objReportingService.SessionHeaderValue = new SessionHeader();
    // Decrypting Report UserName and Password
    string strUserName = GetConfigSetting(ConstantsAndEnums._VOTE_REPORT_USER_NAME);
    strUserName = objCryptographyLib.DoDecryption(strUserName);
    string strPwd = GetConfigSetting(ConstantsAndEnums._VOTE_REPORT_PASSWORD);
    strPwd = objCryptographyLib.DoDecryption(strPwd);
    string strDomain = GetConfigSetting(ConstantsAndEnums._VOTE_REPORT_DOMAIN);
    // Add a NetworkCredential instance to CredentialCache.
    // Negotiate for NTLM or Kerberos authentication.
    CredentialCache cache = new CredentialCache();
    cache.Add(new Uri(objReportingService.Url), "Negotiate",
    new NetworkCredential(strUserName, strPwd, strDomain));
    // Assign CredentialCache to the Web service Client Proxy(myProxy) Credetials property.
    objReportingService.Credentials = cache;
    Byte[] bytReportData;
    ParameterValue[] RepParamValues = new ParameterValue[7];//Changed BY Ankur from 5 to 7 , on 25 Nov 2006
    RepParamValues[0] = new ParameterValue();
    RepParamValues[0].Name = "p_intFundId";
    RepParamValues[0].Value = Convert.ToString(intFundID);
    RepParamValues[1] = new ParameterValue();
    RepParamValues[1].Name = "p_bitFundPartofTrust";
    RepParamValues[1].Value = Convert.ToString(blnPartOfTrust);
    // added By Ankur 24 nov 2006
    RepParamValues[2] = new ParameterValue();
    RepParamValues[2].Name = "p_strICAFN";
    RepParamValues[2].Value = strICAFN;
    // added By ankur 25 nov 2006
    RepParamValues[3] = new ParameterValue();
    RepParamValues[3].Name = "p_strRepPrdIDs";
    RepParamValues[3].Value = strRepPeriodIDs;
    // Added By Ankur Ends 25 Nov 2006
    // added By Ankur Ends 24 Nov 2006
    RepParamValues[4] = new ParameterValue();
    RepParamValues[4].Name = "p_dtApprovalDate";
    RepParamValues[4].Value = Convert.ToString(dtApprovalDate);
    RepParamValues[5] = new ParameterValue();
    RepParamValues[5].Name = "p_IssuerStartsWithUpper";
    RepParamValues[5].Value = strIssuerStartsWithUpper;
    RepParamValues[6] = new ParameterValue();
    RepParamValues[6].Name = "p_IssuerStartsWithLower";
    RepParamValues[6].Value = strIssuerStartsWithLower;
    string strEncoding = string.Empty;
    string strMimeType = string.Empty;
    Warning[] warnings = null;
    ParameterValue[] reportHistoryParameters = null;
    DataSourceCredentials[] objCredentials = null;
    string[] strStreamIDs = null;
    string strReportName = "/GLP Reports/FormNPX";
    // throws an error, orinally using Excel... 
    string strFormat = "Text";
    bytReportData = objReportingService.Render(strReportName, strFormat, null, null,
    RepParamValues, objCredentials, string.Empty, out strEncoding, out strMimeType,
    out reportHistoryParameters, out warnings, out strStreamIDs);
}

btw, this is the error I received when I attempted to use Text as format.

Error Message An attempt has been made to use a rendering extension that is not registered for this report server. ---> An attempt has been made to use a rendering extension that is not registered for this report server. ---> An attempt has been made to use a rendering extension that is not registered for this report server. : System.Web.Services.Protocols.SoapException: An attempt has been made to use a rendering extension that is not registered for this report server. ---> An attempt has been made to use a rendering extension that is not registered for this report server. ---> An attempt has been made to use a rendering extension that is not registered for this report server.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at GLP.Utils.ReportingService.Render(String Report, String Format, String HistoryID, String DeviceInfo, ParameterValue[] Parameters, DataSourceCredentials[] Credentials, String ShowHideToggle, String& Encoding, String& MimeType, ParameterValue[]& ParametersUsed, Warning[]& Warnings, String[]& StreamIds) in C:\ViewPoint3\GLP\Utils\DataStructures\ReportingService.cs:line 741
at GLP.Reports.Business.Impl.bReports.GenerateNPXDisplayFundReport(Int32 intFundID, Boolean blnPartOfTrust, String strICAFN, String strRepPeriodIDs, DateTime dtApprovalDate, String strReportDeliveryOptions, String strIssuerStartsWithUpper, String strIssuerStartsWithLower) in C:\ViewPoint3\GLP\Reports\bReports\bReports.cs:line 3083
at GLP.ProxyManagement.Presentation.Impl.pDisplayFundReport.btnGenerateReport_Click(Object sender, EventArgs e) in C:\ViewPoint3\GLP\GLPWeb\GLPReports\DisplayFundReport.aspx.cs:line 1387
Process Name: c:\windows\microsoft.net\framework\v2.0.50727\aspnet_wp.exe
Win32 Thread Id: 7684
Thread Name: 
Extended Properties: