none
generating document level addin from application level addin RRS feed

  • Question

  • HI All,

                 This is very special requirement from our customers. =>

    Our customer's main working tool is word and excel. They write their specs and deliver it to their clients and users. so we have developed an application level addin for them which enables their work so easy. we create an industry standard format data view from their spec using addin ribbon controls. now they are saying that they need a feature in our application level addin tool, such that they can create a document level addin from it which will be delivered with the document so that their user can also get tool benefit. we are naming it executable spec. document level addin will only have  set of features than application level addin.

    so my question is, is it possible to create document level customization addin (ribbon controls) from application level addin. if no, then can you please give me an idea to solve my problem.

    thanks

    shashank


    shashank

    Wednesday, April 10, 2013 6:38 AM

Answers

  • Hi shashank

    As far as I know, it's not possible to digitally sign a VBA project programmatically, it must be done in the VBA Editor, Tools menu. A document can be signed digitally by your code, but that's not the same as code-signing a macro.

    If you want to generate macros on-the-fly Office does provide the Visual Basic Extensibility Library 5.3, available to .NET as PIA. This is accessible through the Word application's object model, in this case, it would be through Document.VBProject.VBComponents. The VBE library lets you load text (macros) from a text file, from a string or you can edit the lines in a module.

    In a Word Open XML document a VBA project is included as a *.bin file, in the old, properietary binary file format. This means you could add an existing VBA project to an existing, closed Word file (usually using the Open XML SDK).

    Theoretically, it would be possible for you to generate the VBA binary file from scratch, as the old binary file format has been released to the public, but that's not something I've ever tried.

    The problem of digitally signing the VBA project remains, no matter which of the three approaches you'd choose. Programmatically, the best you could hope for would be to use SendKeys to mimic the user's actions in the VBA Editor. But correctly, a VBA project needs to be signed by a user in the VBA Editor.


    Cindy Meister, VSTO/Word MVP, my blog

    Tuesday, April 16, 2013 12:43 PM
    Moderator

All replies

  • Hi shashank

    <<is it possible to create document level customization addin (ribbon controls) from application level addin>>

    Mmm. Maybe. A lot depends on the scope the Ribbon controls should have and what other things the documents should be capable of...

    For example, would the user simply select from a pre-set collection of controls, for which the code all exists, or from built-in controls supplied with the Office application?

    Or would you also be having to generate code on-the-fly to work with these controls?

    Could the Ribbon be linked to VBA code, rather than .NET code?

    What else would the document-level customization need to include?


    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, April 10, 2013 8:45 AM
    Moderator
  • HI Cindy,

                   Honestly, i am on a blind turn. At this movement, i dont know how it will work and how it gonna be. We are very excited to build this feature i.e. 'executable spec'. Please see my reply

    <<would the user simply select from a pre-set collection of controls, for which the code all exists, or from built-in controls supplied with the Office application?>>

    Reply: Well, at this movement, we don't know. you can assume any of both option. once things are clear than we will decide what to choose from both or may be use both.

    <<Or would you also be having to generate code on-the-fly to work with these controls?>>

    Reply: Well again, it depends. if i can use same code base of application level addin, it will be good but i am open for generate new code also.

    <<Could the Ribbon be linked to VBA code, rather than .NET code?>>

    Reply: Again this does not matter. Could be any code. BTW my application level addin built on VSTO and c#

    <<What else would the document-level customization need to include?>>

    Reply: this answer needs little more details of this requirement. let me explain you.

    my application level addin have set of buttons in ribbon. Any documents may have 100-200 of tables in it. these tables and thus document is generated from set of buttons in ribbon. one of the button is responsible for creating xml of those tables data and doing xml transformation for different views.(there are lots of other activities also involved but i don't want to discuss). we create around 10 views from that xml. our license is based on what view you want. customers buys according to their requirement. Now for 'executable spec', customer will have feature to create another document(or same document) which will have document level addin. this document level addin will have few buttons. like the one responsible for creating xml and xml transformation. now they delivered it to their users. so that their successive user can also see the same view on the fly. even they can change table data and see effect.

    so at this movement, I first need your guidance for analyzing what things are possible with my current scenario. and then what i need to do?

    there are millions of documents are their in the market and we are targeting them with this concept  of 'executable spec'. 

    my current application level addin have references to number of libraries and total size of directory bin/Release goes to 90 MB. 

    we want executable spec in such a way that if i email you, you get it, open it, and use it directly from document. you don't need to install any application level addin.

    very excited to get your response on this


    shashank

    Wednesday, April 10, 2013 1:56 PM
  • Hi shashank

    <<we want executable spec in such a way that if i email you, you get it, open it, and use it directly from document. you don't need to install any application level addin.>>

    One of the very first things you need to consider, then, is what kind of code can run on the recipient's machine. VSTO code (document-level customization) does not travel with the document. A VSTO solution's code is separate from the document and will not travel with it via Email. This means that the recipient would have to install the VSTO solution and that the solution would need to be mailed (probably as a Click-Once) rather than just the document.

    VBA code in a document would travel with the document. However, not all companies would allow such a document to open and run the code, due to security considerations. At the very least, you'd have to digitally sign the VBA project in the document.

    The other possibility would be the new "Office apps" technology, but this is only available for Office 2013 and isn't really "mature" enough, yet, to fully support what I understand your requirements to be. In any case, it works more like an application-level add-in and would not be document-specific.

    You might want to discuss this with your client before we take this discussion any further...?


    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, April 10, 2013 3:47 PM
    Moderator
  • HI Cindy,

                 So far with the discussions with my team and clients, all we want , to create an executable spec and inbuilt solution in such a way that it don't need an application level addin to execute. As you said about the security issue, it will not be a big deal, if the solution is good. we can digitally sign it [like you said], just we need a solution which can be plugged-in to my current application level addin. VSTO solution will not work because VSTO code does not travel with document but VBA does, so can we go ahead with VBA solution or do you have something else in your mind.? Also, can we automate the process of digitally signing the VBA code through my current application level addin. You asked me two important questions in your first post regarding generating code on-the-fly and linking ribbon with VBA code rather .net code. I assume , the context of these question was with the VBA solution, you discussed. please guide me how to go further.

    thanks


    shashank

    Tuesday, April 16, 2013 8:05 AM
  • Hi shashank

    As far as I know, it's not possible to digitally sign a VBA project programmatically, it must be done in the VBA Editor, Tools menu. A document can be signed digitally by your code, but that's not the same as code-signing a macro.

    If you want to generate macros on-the-fly Office does provide the Visual Basic Extensibility Library 5.3, available to .NET as PIA. This is accessible through the Word application's object model, in this case, it would be through Document.VBProject.VBComponents. The VBE library lets you load text (macros) from a text file, from a string or you can edit the lines in a module.

    In a Word Open XML document a VBA project is included as a *.bin file, in the old, properietary binary file format. This means you could add an existing VBA project to an existing, closed Word file (usually using the Open XML SDK).

    Theoretically, it would be possible for you to generate the VBA binary file from scratch, as the old binary file format has been released to the public, but that's not something I've ever tried.

    The problem of digitally signing the VBA project remains, no matter which of the three approaches you'd choose. Programmatically, the best you could hope for would be to use SendKeys to mimic the user's actions in the VBA Editor. But correctly, a VBA project needs to be signed by a user in the VBA Editor.


    Cindy Meister, VSTO/Word MVP, my blog

    Tuesday, April 16, 2013 12:43 PM
    Moderator
  • Thanks Cindy,

                             Thanks for your valuable feedback.  I will let you know if i stuck somewhere.

    regards

    shashank


    shashank

    Thursday, April 25, 2013 5:37 AM