Closed benjamin-almarza closed 7 months ago
Hi, I can not repro this issue. I am just wondering whether you can provide more details.
Hi: I figured out something weird.
If we do the following:
Then the issue happens as I described
But if we do the following:
Then it doesn't fails I can see that the document.xml inside the docx changes a little
I attached a brand new file that fails consistently when I upload it : test_file_2.docx
Please upload this and test
I attached the document.xml before and after: document_after.xml document_before.xml
The most significative change I can see is from this:
<w:sdtContent>
<w:r>
to this:
<w:sdtContent>
<w:r w:rsidRPr="6826A8E4" w:rsidR="73081A6C">
I am just wondering how you insert a content control. It seems I cannot get any content controls for you document. But it can be get for new inserted content control.
1.- How we created the document
We are creating programmatically the document using aspose
This is the snippet of the code
#create a new content control
sdt = Rjb::import('com.aspose.words.StructuredDocumentTag').new(aspose_doc, sdt_type_plain_text, markup_level_inline)
#lock it to prevent from accidental deletion in MS-Word
sdt.setLockContentControl(true)
#add tag for identification
sdt.setTag(tag_text)
#set text for context control, font etc.
sdt.appendChild(run_node(display_text, fontName, fontSize, fontColor))
sdt.isShowingPlaceholderText(false)
#replace the default text message
sdt.getRange.replace("Click here to enter text.", "", false, false)
doc_builder.insertNode(sdt)
2.- The contentControls we have. For every purpose, the contentControls we create work fine.
They look and behave as normal contentControls as you can see
Besides, one of our requirements is that we cannot control the documents received from our clients. If it is a validly created Docx with contentControls we should be able to interact with them.
3.- Document to test
I attached a document before and after downloading it from office.com. If you upload both to office.com and run the test I gave you, in one the contentControl "contract name" will work and in the other not. This may be useful to test because they are practically the same file.
@RuoyingLiang Did you get a chance to look into this case? We are pretty stuck and blocked on this issue.
I am just wondering whether you can try richtext content control.
The issue is tracked in our backlog as ADO#5705306.
The issue disappears when we change plain text content control to rich text. (Thanks, this would help us for the newer created documents, but we need a solution for the old one )
We add an event in the document that triggers when a contentControl is modified. Our issue is that in some documents (not all) the placeholder is null from the point of view of the addin.
Your Environment
Platform [PC desktop, Mac, iOS, Office on the web]: Office on the web Host [Excel, Word, PowerPoint, etc.]: Word Operating System: Windows 10 Pro Browser (if using Office on the web): Chrome is up to date Version 96.0.4664.110 (Official Build) (64-bit)
Expected behavior
On selecting inside a contentControl: we should be able to access its tag and id.
Current behavior
On selecting inside a contentControl: contentControl.isNullObject is true.
Steps to reproduce
Upload the file bug_file.docx to office.com
Run the following code in Office Word addin online
Click with the mouse in the word "placeholder"
Ideally, the line "console.log(value);" should be run.
Context
Our application relies heavily on contentControl without this piece it doesn't work.