File Formats - DocIO encrypting and saving a document issue when using the Fluent Ribbon

Hi
Firstly, sorry about the platform choice but i couldn't see the File Formats platform option..

I'm trying to use the DocIO Word/excel library as part of our desktop application to save an encrypted file to the disk on a users machine.

However, before the document gets to the desktop app, we use the fluent ribbon api to remove alot of the menu options (save as, options etc). 

This is done using a customUI.xml file as detailed in this article - https://docs.microsoft.com/en-us/office/vba/library-reference/concepts/overview-of-the-office-fluent-ribbon.

The issue is that after saving with the sync fusion DocIO api we loose all of our original ribbon settings. 

Is there anything we can do about this? I don't want to have to re do all of the work in the ribbon when saving through the DocIO library. 

Thanks in advance

4 Replies

VR Vijay Ramachandran Syncfusion Team September 19, 2018 12:48 PM UTC

Hi Justin,

Thank you for contacting Syncfusion support.

Essential DocIO will preserve the CustomUI.xml file as it is, while opening and re-saving the Docx document. We suspect that you may perform any manipulations before saving a Word document and it might be a reason for this issue. So, kindly provide us the following details thereby we will analyze further and provide you a prompt solution at the earliest.
 
    1. Input Word document.
    2. Code snippets used to manipulate this document or Sample.

Please let us know if you have any questions.

Regards,
Vijay R
 



JC Justin Crowe September 19, 2018 01:25 PM UTC

Hi, thanks for the quick reply!

That's good news that the sync fusion lib does support it. I suspect it's something we are doing wrongly then.

I have attached a few files. Input (before Syn Fusion) and output (after Sync Fusion set password) docs and their corresponding .rels files that show a difference.

The code we use SyncFusion library is below:

          try
            {   
                using (MemoryStream stream = new MemoryStream(myBytes))
                {
                    using (var msToEncrypt = new MemoryStream())
                    {
                        stream.CopyTo(msToEncrypt);
                        using (Syncfusion.DocIO.DLS.WordDocument wordDocument = new Syncfusion.DocIO.DLS.WordDocument(msToEncrypt, Syncfusion.DocIO.FormatType.Automatic))
                        {
                            wordDocument.EncryptDocument(password);
                            wordDocument.Save(msToEncrypt, _defaultWordDocumentFormat);
                            wordDocument.Close();
                            myBytes = msToEncrypt.ToArray();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
            }
            return myBytes;

The version of office is read from a registry lookup. Could that be the cause? Does a different rels file get built depending on version?

          switch (version)
            {
                case 14:
                    _defaultWordDocumentFormat = Syncfusion.DocIO.FormatType.Word2010;
                    break;
                case 15:
                    _defaultWordDocumentFormat = Syncfusion.DocIO.FormatType.Word2013;
                    break;
                default:
                    _defaultWordDocumentFormat = Syncfusion.DocIO.FormatType.Docx;
                    break;
            }

Thanks


Attachment: Docs_8aa78ba5.zip


DB Dilli Babu Nandha Gopal Syncfusion Team September 24, 2018 07:37 AM UTC

Hi Justin, 
 
Thank you for your patience. 
 
We have confirmed that reported issue with “Custom UI is preserved improperly while resaving a Word document” is a defect. The fix for this issue will be included in our upcoming service pack release v16.3 SP1 which is estimated to be available by October, 2018. 
 
Regards, 
Dilli babu. 



DB Dilli Babu Nandha Gopal Syncfusion Team January 9, 2019 06:31 PM UTC

Hi Justin 

We have fixed the reported issue and included in our 2018 Volume 3 Service Pack 1 release. We are glad to announce that our Essential Studio Volume 4, 2018 release (v16.4.0.42) is rolled out and is available for download under the following link. 

  
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 

Regards, 
Dilli babu. 


Loader.
Up arrow icon