locked
Merge Cells or Copy Existing Worksheet or Copy Existing Range RRS feed

  • Question

  • This is actually a question for Office 2016 Javascript API For Excel.  I don't see a forum for that yet, is there one?

    I am trying to replace some older VBA applications with this new technology and am coming up empty trying to duplicate what the VBA is doing.

    For starters I have this nice Worksheet with some Merged Cells in it.  I'd like to duplicate that worksheet into Javascript because the user will be creating multiple instances of this.  So I want to take and hide the template.  But I don't see a method to copy a worksheet.  Is there one?

    So next I'd like to just take the range with merged cells and all and just copy that to a new worksheet...Can't figure out if that can be done either.  Can it?

    Finally I can just write the code to create the range from scratch, except I see no way to merge cells?

    I hope this is just version 1 issues and in coming months this model will be a lot more mature.   But if anyone can answer any of my four questions (including is there a forum for 2016), I would very much appreciate it.


    Thanks, Brian

    Wednesday, February 24, 2016 3:01 PM

Answers

  • Hi Brian,

    Thanks for posting in MSDN forum. This forum is the right place to discuss developing issues about Office add-in.

    >>I am trying to replace some older VBA applications with this new technology and am coming up empty trying to duplicate what the VBA is doing.

    The Office add-in is different with the VBA or VSTO technology. It emphasize intact the data in the Office with Office add-in instead of automating the Office application. However, from Office 2016 it also enhance the behavior of automating. You can refer to the link below:
    Excel add-ins JavaScript API reference

    >> I'd like to duplicate that worksheet into Javascript because the user will be creating multiple instances of this.  So I want to take and hide the template.  But I don't see a method to copy a worksheet.  Is there one?

    No.

    >>So next I'd like to just take the range with merged cells and all and just copy that to a new worksheet...Can't figure out if that can be done either.  Can it?

    We can get the data from the selection or binding object and set the data where we want. However, there is also no copy range method.

    >>Finally I can just write the code to create the range from scratch, except I see no way to merge cells?

    There is no such API we can merge the cells using JavaScript API for Office.

    Base on the requirement, it more likely automate the Office application. For this scenario, you may consider VSTO technology for deploy easily. And here are some helpful articles about this topic:

    VBA and Office Solutions in Visual Studio Compared

    Chapter 12: Migrating VBA Solutions to VSTO

    In addition, if you have any idea or feedback about Office add-in, you can try to contact the Office Developer Team from link below:
    Customer Feedback for the Office Developer Platform

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, February 25, 2016 2:00 AM

All replies

  • Hi Brian,

    Thanks for posting in MSDN forum. This forum is the right place to discuss developing issues about Office add-in.

    >>I am trying to replace some older VBA applications with this new technology and am coming up empty trying to duplicate what the VBA is doing.

    The Office add-in is different with the VBA or VSTO technology. It emphasize intact the data in the Office with Office add-in instead of automating the Office application. However, from Office 2016 it also enhance the behavior of automating. You can refer to the link below:
    Excel add-ins JavaScript API reference

    >> I'd like to duplicate that worksheet into Javascript because the user will be creating multiple instances of this.  So I want to take and hide the template.  But I don't see a method to copy a worksheet.  Is there one?

    No.

    >>So next I'd like to just take the range with merged cells and all and just copy that to a new worksheet...Can't figure out if that can be done either.  Can it?

    We can get the data from the selection or binding object and set the data where we want. However, there is also no copy range method.

    >>Finally I can just write the code to create the range from scratch, except I see no way to merge cells?

    There is no such API we can merge the cells using JavaScript API for Office.

    Base on the requirement, it more likely automate the Office application. For this scenario, you may consider VSTO technology for deploy easily. And here are some helpful articles about this topic:

    VBA and Office Solutions in Visual Studio Compared

    Chapter 12: Migrating VBA Solutions to VSTO

    In addition, if you have any idea or feedback about Office add-in, you can try to contact the Office Developer Team from link below:
    Customer Feedback for the Office Developer Platform

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, February 25, 2016 2:00 AM
  • Thanks for the responses and links.   We really like the start of the Javascript API, but I hope that model really continues to mature.   There are lots of holes right now and inconsistencies.   With binding objects you can do some things such as turn off filtering, autofit cells, etc. that you can't do with the Range object or even the Table object in the newer API.  Seems strange some of this is missing from the newer components.  I have to go back to the older API methods to get some things done.  I really hope, Microsoft is committed to further developing this object model, it seems like a good road to go down, just right now there are too many roadblocks.  I did add some suggestions, thanks for the customer Feedback site.   I really hope they are taken seriously.

    Thanks, Brian

    Thursday, February 25, 2016 2:43 PM