Skip to content
This repository has been archived by the owner on Jun 12, 2019. It is now read-only.

Paragraph lose formatting after using InsertOOXML method #272

Closed
AlexYovenko opened this issue Jun 10, 2016 · 9 comments
Closed

Paragraph lose formatting after using InsertOOXML method #272

AlexYovenko opened this issue Jun 10, 2016 · 9 comments
Assignees

Comments

@AlexYovenko
Copy link

AlexYovenko commented Jun 10, 2016

Hello,

My team faced with issue that after document was converted to OOXML by using getOOXML method and then inserted into document by using InsertOOXML - paragraphs that have "Normal" style lose their formatting.

We run some investigation and found that after getOOXML method formatting inside converted to XML structure still exist:

pkg:name="/word/fontTable.xml"

<w:font w:name="Britannic Bold">
  <w:panose1 w:val="020B0903060703020204"/>
  <w:charset w:val="00"/>
  <w:family w:val="swiss"/>
  <w:pitch w:val="variable"/>
  <w:sig w:csb0="00000001" w:csb1="00000000" w:usb0="00000003" w:usb1="00000000" w:usb2="00000000" w:usb3="00000000"/>
 </w:font>

As well in styles part:

pkg:name="/word/styles.xml"

 <w:style w:type="paragraph" w:default="1" w:styleId="Normal">
  <w:name w:val="Normal"/>
  <w:qFormat/>
  <w:rsid w:val="00992D4A"/>
  <w:rPr>
   <w:rFonts w:ascii="Britannic Bold" w:hAnsi="Britannic Bold"/>
   <w:sz w:val="24"/>
  </w:rPr>
 </w:style>

But after we insert this OOXML to document - paragraph lose formatting and just use regular formatting option for Normal style.

I think it's a bug, please advice.
Attached before.docx document - it's document created in Native MS Word with custom formatting for Normal style.
after.docx - inserted OOXML by Office JavaScript API

after.docx
Before.docx
ooxml.txt

@OleksiiD
Copy link

Interesting find... Will check it in my environment. If it is really so, it may be a problem for me, as our users often change formatting.

@AlexYovenko
Copy link
Author

@JuaneloJuanelo Any update here?

@ghost
Copy link

ghost commented Jul 1, 2016

@JuaneloJuanelo, I found a similar problem on my app. Please tell me what you think about this bug.

@AlexYovenko
Copy link
Author

Hello @JuaneloJuanelo,

Any update here?

@AlexYovenko
Copy link
Author

Hi,

Any update, advice?

@JuaneloJuanelo
Copy link
Contributor

Hello i just saw this. Btw this types of issues are better to be shared in stack! , the goal of github is to talk about the designs of the API. I am trying to repro the issue now. thanks!

@JuaneloJuanelo
Copy link
Contributor

JuaneloJuanelo commented Aug 2, 2016

Ok Alex, here is the result of the investigation. We do have a small bug.
The issue here is how the "Normal" style (specifically) behaves in Word. You can compare the behavior as to how copy-paste works.

if you copy paste the contents of your before.docx document into a blank document you will see that the style for "Normal" is overwritten in the new document.

if you copy paste the contents of your before.docx into a document already using the "Normal" style (i.e. type a few letters on it with the normal style) you will see that the Normal style of the pasted text will be be like the Normal style of the new document (youre before.docx Normal style will be ignored, basically) This is a by-design behavior in Word, we don't want to modify the style of the existing content.
The bug that we have is that we should actually override the style if the destination document is BLANK. and we will work on a fix for this.

Now, I have one advice for you. Instead of using the Normal style, i recommend you to create a new one, this will safely propagate your OOXML with the intended style. (please try creating a style using OOXML as well!)

thanks for reporting this issue and let me know if you have additional meta-questions.

@AlexYovenko
Copy link
Author

The problem here that we not owners of documents that will be used in Office add-in app, client create their own templates with their styles settings.

Thank for review this, we will wait for fix, when you think it's can be released?

>Btw this types of issues are better to be shared in stack!
What you mean, can you please share link?

@Lauragra
Copy link
Contributor

Lauragra commented Aug 4, 2016

You can post questions to StackOverflow, tagged with office-js. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants