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

Free Support Forum - aspose.com

Exception when exporting using aspose.doc

Hi, I just tried using Aspose.Word Yesterday,


I tried to use apose to render a localreport from my report viewer(I’m using report viewer Ver. 10.0.0.0)
when I try to Render the report using Aspose extension(Docx, Xml, etc),
I got this exception :
Object of type ‘Aspose.Words.ReportingServices.WordMLRenderer’ cannot be converted to type ‘Microsoft.ReportingServices.OnDemandReportRendering.IRenderingExtension’.

I am using the Aspose.Words for Reporting Services 4.4.1 (.Zip).
And try to use it by following this guide :
http://www.aspose.com/docs/display/wordsreportingservices/Integrate+with+Microsoft+Report+Viewer+in+Local+Mode

Can you help me?


Hi Agustinus,

Thanks
for your inquiry. It would be great if you please use the select statement (to populate the data) inside
your RDL file and share that RDL file with us. I will investigate the
issue on my side and provide you more information. Please see the following DataSet example with select statement for your kind reference:


<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>



Sorry,

but it seems there is no problem with the rdl or the data source.

Here I attach a very simple project that I create that have the same error.

The project contain a report that just show a label, without any data set.
and a web page that will populate the report if the generate button is clicked,
and export it to word if export button is clicked.

but when I tried to use the export button I get the Error.
Unable to cast object of type ‘Aspose.Words.ReportingServices.DocxRenderer’ to type 'Microsoft.ReportingServices.OnDemandReportRendering.IRenderingExtension’

It seems that I will get the error if I try to use the ReportViewer1.LocalReport.Render Method.

Is there A way to use Aspose.Word rendering extension for this case?

Because I need the export button in a separate place (not in the report viewer tool bar).

And another thing is that when I use the ReportViewerHelper.AddAsposeExtensions to populate the extension, each time I click generate it will create a new tab in my browser(I use Google Chrome).

But If I use
ReportViewerHelper temp = new ReportViewerHelper(ReportViewer1);
temp.AddExtensions();
then I will get an Error even if I try to export using the command in the report viewer tool bar.

Can You help me with this?

Thank you

Hi Agustinus,

Thanks for sharing the detail. I have tested the scenario and have managed to reproduce the same issue at my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSRPT-209. 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.