Open A .docx Document

i need to open a document in yii application in order to print it.

in a folder i have a x.php file, and a y.docx file

in x.php file i wrote:

<h3> <?php echo CHtml::link('Back', array('/site/page', 'view'=>'y.docx'));?> </h3> 

<a href="y.docx">Click</a>

in the first link the result is : The requested view "y.docx" was not found.

the second link’result is: The system is unable to find the requested action “y.docx”.

can anyone help me, how to generally open a document file?

You’ll need an external library to do what you want.

Here’s one that should allow you to open a Word document:

it seems that this library generate docx report. i already used the mpdf extension to generate docx and pdf reports. the problem now is to open the generated reports or any other docx documents.

for example if i generated a report using one of these libraries or extension, and i put the output result in protected/reports folder. and i created a link to open the generated documents, how to write this link?

thank you

May be the document is not linked correctly

<a href="path_to_y.docx">Click</a>

i generated a pdf report under \protected\reports\StudentReports\certificate.pdf folder

when i generate the report, it redirect me to the following path:


in this page, i need to make a link to the studentReports to open certificate.pdf

anyone have any idea how to make this happen.

thank you