Aspose word - render reports programmaticaly - exception

Hi,

I am trying to use Aspose.Word to render SSRS report to html in WPF(.net 4.0) in local mode. I followed your guide from link https://docs.aspose.com/words/reportingservices/rendering-reports-programmatically/. However, I met exception Unable to cast object of type ‘Aspose.Words.ReportingServices.MhtmlRenderer’ to type ‘Microsoft.ReportingServices.OnDemandReportRendering.IRenderingExtension’. But I can render from report viewer toolbar.

Could you please support me to solve it?

Besides, can I render directly report to html without reportviewer? and where to configure Aspose word for reporting service?

Thanks,

Phuong

Hi Phuong,

Thanks for your inquiry. Yes, you can export RDL file into HTML without using Report Viewer. If you have a Report Server running with Aspose.Words for Reporting Services installed on it, you can render reports to Microsoft Word documents using the Reporting Service Web Service. Please read the section ‘Rendering via Reporting Services Web Service’ from here:
https://docs.aspose.com/words/reportingservices/rendering-reports-programmatically/

Regarding mhtml issue, could you please attach your WPF along with RDL file here for testing? Are you facing this issue only with mhtml or all other export file format e.g Doc/Docx/HTML ?

Please use select statement (to populate the data) inside your RDL as shown in following DataSet example. I will investigate the issue on my side and provide you more information.

<DataSets>
	<DataSet Name="DataSet1">
		<Query>
			<DataSourceName>DataSource1</DataSourceName>
			<CommandText>
				select 1 as value, ‘label1’ as label
				union all
				select 2 as value, ‘label2’ as label
				union all
				select 3 as value, ‘label3’ as label
				union all
				select 4 as value, ‘label4’ as label
			</CommandText>
		</Query>
		<Fields>
			<Field Name="value">
				<DataField>value</DataField>
				<rd:TypeName>System.Int32</rd:TypeName>
			</Field>
			<Field Name="label">
				<DataField>label</DataField>
				<rd:TypeName>System.String</rd:TypeName>
			</Field>
		</Fields>
	</DataSet>
</DataSets>

Thanks your reply.

We cannot use report server. We must use SSRS with local mode and currently I am facing this issue when we call method render to any type. However, I can export from toolbar of report viewer.

Besides, to send mail with images, which output type can we do html or mhtml?

Thanks,

Phuong

Hi Phuong,

Thanks for sharing the detail. I am working over your query and will update you asap.

Hi Phuong,

Thanks for your patience. I have logged this issue as WORDSRPT-138 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSRPT-138) have been fixed in this Aspose.Words for Reporting Services update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.