我正在使用PHPword生成word文档。我想生成多个文档,以便使用模板。我在控制器中尝试了以下代码:
$templateProcessor = new TemplateProcessor('resources/Sample_07_TemplateCloneRow.docx');
$templateProcessor->setValue('Name', 'John Doe');
$templateProcessor->setValue(array('City', 'Street'), array('Detroit', '12th Street'));
,并显示以下错误:
copy(resources/Sample_07_TemplateCloneRow.docx): failed to open stream: No such
file or directory
在:
// Template file cloning
if (false === copy($documentTemplate, $this->tempDocumentFilename)) {
throw new CopyFileException($documentTemplate, $this->tempDocumentFilename);
}
模板处理器的默认目录是什么?否则我们必须手动指定位置。请帮忙!
PHP版本:7.0 拉拉韦尔5.5 PHPWord版本:0.14
答案 0 :(得分:1)
这对我有用: Sample_07_TemplateCloneRow.docx放在/ storage目录中。并使用此行:
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
lonlats = np.array([[-73.134961, 40.789142], [-75.46884485, 41.13443837],
[-77.825617, 41.43196017], [-80.20222645, 41.68077343],
[-82.5953765, 41.88007994], [-85.00155934, 42.02922872],
[-87.4170967, 42.12772575], [-89.83818577, 42.17524151],
[-92.26094893, 42.17161608], [-94.68148587, 42.11686169],
[-97.09592644, 42.01116249], [-99.50048253, 41.8548717],
[-101.89149735, 41.6485061], [-104.26549065, 41.39273816],
[-106.61919861, 41.08838607], [-108.94960746, 40.73640202],
[-111.25398017, 40.33785904], [-113.52987601, 39.89393695],
[-115.7751629, 39.40590768], [-117.98802295, 38.87512048],
[-120.16695169, 38.3029872], [-122.3107517, 37.6909682]])
for frame in range(0, len(lonlats)):
ax = plt.axes(projection=ccrs.Orthographic(central_longitude=lonlats[frame][0], central_latitude=30))
ax.background_img(name='BM', resolution='medium')
line = plt.plot(lonlats[:frame + 1, 0], lonlats[:frame + 1, 1], color='red', transform=ccrs.PlateCarree())[0]
plt.savefig(f'img{frame:03}.png')
#print(f'img{frame:03}.png')
plt.close()