how to disable .doc/xls file Rribbon and backstate when they are opened with office 2010 RRS feed

  • Question

  • Hi all,

    I'd like to disable the backstage, no matter the file is .doc or docx. I use following code to disable .docx file successfully, However, it throws exception opening .doc file? is it possible to disable the backstage and ribbon of .doc file?

    using (WordprocessingDocument wpd = WordprocessingDocument.Open(@".\test.doc", true))
     private bool CreateRibbon(WordprocessingDocument WDP)
                bool result = false;
                MainDocumentPart MDP = WDP.MainDocumentPart;
                    RibbonExtensibilityPart REP = WDP.AddRibbonExtensibilityPart();
    		string xml = "<customUI xmlns=\"\">"
     			+ "<backstage>"
                      		+ "<tab idMso =\"TabNew\" visible =\"false\"></tab>"
    			+ "</backstage>"
          		REP.CustomUI = new CustomUI(xml);
          		result = true;
    		catch (Exception ex)
    		{		System.Diagnostics.Trace.TraceInformation(ex.Message);
    		return false;

    Best Regards

    After Base

    Sunday, December 30, 2012 12:03 PM


  • Hi after_base

    A *.doc file cannot have a "Backstage", nor can you modify or work with a *.doc file using the Open XML SDK. A *.doc file is in the old, proprietary, binary file format that was replaced in Office 2007 with Office Open XML.

    Cindy Meister, VSTO/Word MVP, my blog

    Sunday, December 30, 2012 3:44 PM