Skip to content

Font Styles Not Loading -- w:ascii is not present only W:cs #1235

@Paperclip-Systems

Description

@Paperclip-Systems

This is:

Expected Behavior

The fonts to load even if they are not listed as w:ascii, and retain default styling.

Current Behavior

Fonts not listed as w:ascii are ignored. The file was created in word 2016 and saved as a docx. The style xml does not have the w:ascii tag, so the fonts are not loading causing it to loose its times new roman font setting. Additionally the paragraph styling is not retaining for the default style (in this case it looses it center formatting and goes to left set)

Failure Information

See above. The problem occurs when loading the docx file and writing it out again.

How to Reproduce

Please provide a code sample that reproduces the issue.

require_once './vendor/autoload.php';

use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Settings;

Settings::loadConfig();
$phpWord = \PhpOffice\PhpWord\IOFactory::load("living-will.docx", "Word2007");
$temp_name="/tmp/temp.docx";
$phpWord->save($temp_name, "Word2007", false);
header('Content-Transfer-Encoding: Binary');
header('HTTP/1.1 200 OK');
header('Status: 200 OK');
header('Content-Type: application/octet-stream');
header('Content-Type: application/force-download');
header("Content-Description: File Transfer");
header('Content-Disposition: attachment; filename="living-will.docx');
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-control: private");
header('Pragma: private');
readfile($temp_name);
unlink($temp_name);

Context

living-will.docx
living-will-Output.docx

  • PHP version: 7
  • PHPWord version: latest dev branch

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions