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

Free Support Forum - aspose.com

Rendering to docx format via SSRS SDK for PHP

Hi!

I first tried to contact you via Live Chat last friday but it couldn't contact to any operators. Today it said no operators are available and while I tried to send my question by email it gave 500 Internal Server Error after submitting the question so I decided to ask here. Also there're quite much expired links on your websites (e.g. http://www.aspose.com/reporting-services/total-component.aspx "Examples" buttons).

But here's the main question:

I'm trying to render DOCX format with Aspose.Words SSRS Extension via SSRS SDK for PHP. Naturally, it didn't originally have that format to render docxs 'cause there ain't such format in original SSRS but it was easy to implement because the RenderType's just a subclass that returns format name (here "AWDOCX") with GetFormat method.

While I try to render the report, I get the docx file just fine but while trying to open it with Microsoft Word 2010 it notices that the document's corrupt and couldn't be opened. After confirming "Yes" on the question if I'd like to try and recover the document, it shows the report fine. The original corrupted document couldn't be opened with e.g. 7-zip either so it's hard to figure out what the problem with that format is. After recovering it seems exactly like the one downloaded from ReportViewer. And from ReportViewer it renders the report fine.

Do you have any idea why the format's broken while rendering via PHP SDK?
I'm developing a software with PHP and it would be an important part of it to get the reports straight from it. Also tried to render it as RTF and DOC (formats: "AWRTF" and "AWDOC") while it seemed exactly like the docx one from ReportViewer but then I got documents containing only text (part of RTF given below). It would be necessary to get an editable format of the report and layout has background images etc so PDF or DOC formats don't work.

RTF:

<span style=“font-size:10.5pt;line-height:115%;font-family:“Courier New”;
mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:
FI;mso-fareast-language:EN-US;mso-bidi-language:AR-SA”>{\rtf1\ansi\ansicpg1252\uc0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deff0\adeff0{\fonttbl{\f0\froman\fcharset0\fprq2{*\panose
02020603050405020304}Times New Roman;}{\f1\froman\fcharset0\fprq2{*\panose
05050102010706020507}Symbol;}{\f2\fswiss\fcharset0\fprq2{*\panose
020b0604020202020204}Arial;}{\f3\fnil\fcharset0 Segoe UI;}{\f4\fnil\fcharset0
Segoe UI Semibold;}{\f5\fnil\fcharset0 Segoe UI
Light;}}{\colortbl;\red255\green165\blue0;\red243\green243\blue243;\red0\green0\blue0;\red255\green255\blue255;\red128\green128\blue128;\red236\green124\blue42;\red211\green211\blue211;\red209\green209\blue209;\red255\green0\blue0;}{\stylesheet{\s0\snext0\sqformat\spriority0\li0\lin0\ri0\rin0\ql\faauto\fs24\lang1033\langnp1033
Normal;}{*\cs10\additive\ssemihidden\spriority0 Default Paragraph
Font;}}{*\generator Aspose.Words for .NET 7.0.0.0;}{\info{\title

Hi Miikka,


Please accept my apologies for your inconvenience. I have checked the web links and all are working fine now. Please check it again.

Thanks for your inquiry. Aspose.Words for Reporting Services export RDL files as Docx, Doc, RTF and WordprocessingML. Please read more detail from here:

It would be great, If you please use select statement (to populate the data ) inside your RDL file and share it with us. I will investigate the issue on my side and provide you more information.

Are you facing the same issue without using SSRS SDK for PHP?

Please see the following DataSet example with select statement for your kind reference:

<DataSets><o:p></o:p>

<DataSet Name=DataSet1><o:p></o:p>

<Query><o:p></o:p>

<DataSourceName>DataSource1</DataSourceName><o:p></o:p>

<CommandText>select 1 as value, ‘label1’ as label<o:p></o:p>

union all<o:p></o:p>

select 2 as value, ‘label2’ as label<o:p></o:p>

union all<o:p></o:p>

select 3 as value, ‘label3’ as label<o:p></o:p>

union all<o:p></o:p>

select 4 as value, ‘label4’ as label<o:p></o:p>

</CommandText><o:p></o:p>

</Query><o:p></o:p>

<Fields><o:p></o:p>

<Field Name=value><o:p></o:p>

<DataField>value</DataField><o:p></o:p>

<rd:TypeName>System.Int32</rd:TypeName><o:p></o:p>

</Field><o:p></o:p>

<Field Name=label><o:p></o:p>

<DataField>label</DataField><o:p></o:p>

<rd:TypeName>System.String</rd:TypeName><o:p></o:p>

</Field><o:p></o:p>

</Fields><o:p></o:p>

</DataSet><o:p></o:p>

</DataSets>



Hi!


The same issue isn’t appearing when rendering reports to docx files from ReportViewer. I think the problem’s actually with my custom rendertype in php sdk because I noticed that the variables given inside RenderTypes vary depending on the subclass.

I’ll try to figure out which variables should be given for docx format and try again later.

Would you have any idea about these properties for docx format?

In PHP SDK for DOC format (original SSRS rendering) the RenderType contains these:
AutoFit, ExpandToggles, FixedPageWidth, OmitHyperlinks,OmitDrillthroughs
and those properties are appended to tag in superclass RenderBaseType’s method GetDevInfoXML_Base.

Hi Miikka,


Thanks for your feedback.

If you face any issue while exporting your RDL file to Docx, please share your RDL file here for testing. I will investigate the issue on my side and provide you more information. Please use select statement (to populate the data) inside your RDL file

I haven’t designed the reports myself and got no access to the reporting service (other than viewing them on ReportViewer). I’m just developing the software the report should be included to via SSRS SDK for PHP.

As I told before, the report itself renders docx fine on ReportViewer but the problem seems to be with the SDK.
I know that this isn’t the correct forum for asking questions about the SDK but docx rendering’s not included to it because docx rendering isn’t implemented to SSRS itself.

Are there some ways to use Aspose.Words renderings with PHP other than with Saaspose and using java bridge or com extension?

Hi Miikka,


Thanks for your inquiry. You can render reports to Microsoft Word documents programmatically using the Reporting Service Web Service. Please read the detail from here:
http://www.aspose.com/docs/display/wordsreportingservices/Rendering+Reports+Programmatically

Aspose.Words does not provide any exporter for SSRS SDK for PHP. Please note that Aspose.Words for Reporting Services is a rendering extension aimed at software developers. It supports Microsoft SQL Server 2000, 2005, 2008 and 2012 Reporting Services, as well as in Microsoft Report Viewer 2005 and 2008.

Aspose.Words for Reporting Services is a unique solution that makes it possible to generate reports into Microsoft Word document formats (and more):

  • DOC - Microsoft Word documents
  • OOXML - Office Open XML documents
  • RTF - Rich Text Format documents
  • XML - WordprocessingML documents
  • HTML - Hypertext Markup Language documents
  • MHTML – Web Archive (MIME HTML) documents
  • ODT – OpenOffice/StarOffice documents
  • TXT - Plain Text documents
  • XPS – XML Paper Specification
  • EPUB – Electronic Publications

Hope this answers your query. Please let us know if you have any more queries.

Hi again!


I knew that Aspose.Words doesn’t provice any exporter but that’s exactly what the PHP SDK is for. I figured out that the problem was not with my custom made RenderType but I was giving wrong mime type for Content-Type while trying to download the file. So the rendered docx was fine, but it corrupted when tried to add download headers.

Hi Miikka,


Could you please share your output docx file here for investigation purposes? Perhaps, your custom method add some content at the end of the document (Docx). You can check such contents by opening your Docx in any binary editor.