@@ -244,7 +244,13 @@ function makeDocx ( genobj, new_type, options, gen_private, type_info ) {
244244 outString += '<wp:inline distT="0" distB="0" distL="0" distR="0">' ;
245245 outString += '<wp:extent cx="' + ( objs_list [ i ] . data [ j ] . options . cx * pixelToEmu ) + '" cy="' + ( objs_list [ i ] . data [ j ] . options . cy * pixelToEmu ) + '"/>' ;
246246 outString += '<wp:effectExtent l="19050" t="0" r="9525" b="0"/>' ;
247- outString += '<wp:docPr id="' + ( objs_list [ i ] . data [ j ] . image_id + 1 ) + '" name="Picture ' + objs_list [ i ] . data [ j ] . image_id + '" descr="Picture ' + objs_list [ i ] . data [ j ] . image_id + '"/>' ;
247+
248+ outString += '<wp:docPr id="' + ( objs_list [ i ] . data [ j ] . image_id + 1 ) + '" name="Picture ' + objs_list [ i ] . data [ j ] . image_id + '" descr="Picture ' + objs_list [ i ] . data [ j ] . image_id + '">' ;
249+ if ( objs_list [ i ] . data [ j ] . link_rel_id ) {
250+ outString += '<a:hlinkClick xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" r:id="rId' + objs_list [ i ] . data [ j ] . link_rel_id + '"/>' ;
251+ }
252+ outString += '</wp:docPr>' ;
253+
248254 outString += '<wp:cNvGraphicFramePr>' ;
249255 outString += '<a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/>' ;
250256 outString += '</wp:cNvGraphicFramePr>' ;
@@ -284,7 +290,29 @@ function makeDocx ( genobj, new_type, options, gen_private, type_info ) {
284290 outString += '</w:p>' ;
285291 } // End of for loop.
286292
287- outString += '<w:p w:rsidR="00A02F19" w:rsidRDefault="00A02F19"/><w:sectPr w:rsidR="00A02F19" w:rsidSect="00A02F19"><w:pgSz w:w="12240" w:h="15840"/><w:pgMar w:top="1440" w:right="1800" w:bottom="1440" w:left="1800" w:header="720" w:footer="720" w:gutter="0"/><w:cols w:space="720"/><w:docGrid w:linePitch="360"/></w:sectPr></w:body></w:document>' ;
293+ outString += '<w:p w:rsidR="00A02F19" w:rsidRDefault="00A02F19"/>' ;
294+
295+ // Landscape orientation support
296+ if ( options . orientation && options . orientation == 'landscape' ) {
297+ outString +=
298+ '<w:sectPr w:rsidR="00A02F19" w:rsidSect="00897086">' +
299+ '<w:pgSz w:w="15840" w:h="12240" w:orient="landscape"/>' +
300+ '<w:pgMar w:top="1800" w:right="1440" w:bottom="1800" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/>' +
301+ '<w:cols w:space="720"/>' +
302+ '<w:docGrid w:linePitch="360"/>' +
303+ '</w:sectPr>' ;
304+ } else {
305+ outString +=
306+ '<w:sectPr w:rsidR="00A02F19" w:rsidSect="00A02F19">' +
307+ '<w:pgSz w:w="12240" w:h="15840"/>' +
308+ '<w:pgMar w:top="1440" w:right="1800" w:bottom="1440" w:left="1800" w:header="720" w:footer="720" w:gutter="0"/>' +
309+ '<w:cols w:space="720"/>' +
310+ '<w:docGrid w:linePitch="360"/>' +
311+ '</w:sectPr>' ;
312+ }
313+
314+ outString += '</w:body></w:document>' ;
315+
288316 return outString ;
289317 }
290318
@@ -504,11 +532,26 @@ function makeDocx ( genobj, new_type, options, gen_private, type_info ) {
504532 ) ;
505533 } // Endif.
506534
535+ if ( ( opt || { } ) . link ) {
536+
537+ var link_rel_id = gen_private . type . msoffice . rels_app . length + 1 ;
538+
539+ gen_private . type . msoffice . rels_app . push ( {
540+ type : 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink' ,
541+ target : opt . link ,
542+ targetMode : 'External'
543+ } ) ;
544+
545+ newP . data [ objNum ] . link_rel_id = link_rel_id ;
546+
547+ } // Endif.
548+
507549 newP . data [ objNum ] . image_id = image_id ;
508550 newP . data [ objNum ] . rel_id = image_rel_id ;
509551 } ;
510552
511553 genobj . data [ genobj . data . length ] = newP ;
554+
512555 return newP ;
513556 } ;
514557
0 commit comments