0

My requirement is to open an excel template and edit in memory and then download to user. This needs to be done in .net MVC web project so I tend to use OpenXML instead of InterOp.

The whole idea is I have an excel template which has two sheets. Second sheet contains a set of datasources which I have bound as a range selector in first sheet cells. Now, based on which user is logged in, I need to change the data in datasources and same will be reflected into the first sheet.

This template is added into the project. For concurrency, I don't want to edit this template. I am thinking to either make a copy of this and download it to temp or best if I can take the snapshot of this template in memory and edit the sheet to and then stream it to the response for user to download.

Any help, links, articles based on OpenXML SDK will be really helpful.

user2861226
  • 169
  • 13
  • @AshleyMedway I know how to do that. Do *you*? Can you point at the documentation for Open XML SDK or the NuGet package? What package you say? Do you have any idea how *painful* it would be to use raw OpenXML ? Can you mention one alternative library? – Panagiotis Kanavos Mar 23 '18 at 08:44
  • 1
    @AshleMedway there are *many* duplicates and you should point that out or even vote to close this as duplicate. Attacking someone who asks for help though isn't ... helpful – Panagiotis Kanavos Mar 23 '18 at 08:45
  • The Open XML SDK is a pain to work with. Use a library like EPPlus to load an existing `xlsx` file, modify the cells and save it or write it to the response stream. There are several related questions already – Panagiotis Kanavos Mar 23 '18 at 08:47
  • 1
    @PanagiotisKanavos Yes I have worked with OpenXML many times. I'd say some starts might be https://www.google.co.uk/search?q=open+xml+sdk+documentation&oq=Open+XML+SDK+doc https://www.google.co.uk/search?q=open+xml+nuget https://www.google.co.uk/search?q=working+with+openxml+in+c%23 If you like to discuss in more detail why answering off-topic questions is a bad idea feel free to join me in chat. The downvote reason is `This question does not show any research effort` which is what you'll find on the tooltip when hovering over the downvote button – Ashley Medway Mar 23 '18 at 08:49
  • @AshleyMedway no, I prefer to report the abuse. This is not off topic although it's a duplicate. If you *have* worked you should know how hard it is to start. There's no excuse for abuse – Panagiotis Kanavos Mar 23 '18 at 08:50
  • 1
    @PanagiotisKanavos The off-topic reason is `Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.` – Ashley Medway Mar 23 '18 at 08:54
  • @AshleyMedway if you want to argue go to meta. You won't find anyone to support your abusive comments or the invalid close vote. And read Jon Skeet's blog about SO's culture https://codeblog.jonskeet.uk/2018/03/17/stack-overflow-culture/ – Panagiotis Kanavos Mar 23 '18 at 08:56
  • @AshleyMedway I have seen many examples to create, read and edit excel using openXML but none of them tell me how to preserve the template as is and edit in memory. That is why I posted this question. I don't know what's wrong with this. You may have worked a lot on OpenXML but there are a lot of things you haven't worked on. And when such things come across your way and you don't find any legitimate answer, you turn up to StackOverflows. And how did you draw the conclusion that I have not researched. I think that itself is an abuse. – user2861226 Mar 23 '18 at 09:18

0 Answers0