Can you set the value of an excel control with EPPLUS?












0















Is it possible to set the value of an excel control, for example a textbox or a radio button, with the EPPLUS-library?



We have an excel document that will be used as a template to create other excel files. With EPPLUS you can easily load the template, fill in cell values and save it as a new document like:



var excelPackage = new ExcelPackage(new System.IO.FileInfo(@"C:Template.xlsm"));
excelPackage.Workbook.Worksheets[0].Cells["B11"].Value = "Hello!";
excelPackage.SaveAs(new System.IO.FileInfo(@"C:NewDocument.xlsm"));


However, the excel template also contains textboxes and radiobuttons that we need to assign values to before saving.



We have previously used a non-free library called Spire.XLS to do this, but it's kind of overkill just to do this. Plus it would be nice to not have to deal with license files and such.



We also like to avoid the interop-library since you have to install office on the deployment server.



EPPLUS is a really nice library so if it is possible to use that to do this it would be really nice. If it doesn't support controls, would it be hard to extend it to support this?










share|improve this question























  • I'm not sure I understand so please correct me, you want to save your excel file as a template so that next time when you open a file based on this template all the values are filled by defaults. More precisely, you would like that the by default the radiobuttons and texboxes have the same values as the original file?

    – GTPV
    Nov 14 '18 at 14:53











  • No, the template should never be changed and the radios and textboxes are all empty in the template (not filled out). I only want to make filled out copies of the template. One solution would be to code the entire excel file from scratch with values and all, but the thing is that the template is a customer document that will be updated from time to time. So to avoid code changes every time the template changes (if it's layout changes or such) it is better to use their document as template and only supply the values for specific fields.

    – Fredrik Söderlund
    Nov 14 '18 at 15:47











  • You can loop over all the controls of a spreadsheet "for each ctrl in worksheet(name),controls", then give them a value "ctrl.value ='world' ". Additionally, in your loop, you can put if statements to make sure that only the proper controls are given a value.

    – GTPV
    Nov 14 '18 at 15:52













  • ok. Hmm, I can't find any property "Controls" in ExcelWorksheets. Are we still talking about EPPlus here? Or is some other library?

    – Fredrik Söderlund
    Nov 14 '18 at 16:31











  • There is a property "WorksheetXml" which seems to be the xml representation of the sheet. The xml contains a section "controls", but there is only one control. There should be several. Maybe the textboxes isn't controls but som other excel entity. The textboxes looks like grey resizeable and movable boxes where the user can input text.

    – Fredrik Söderlund
    Nov 14 '18 at 16:38
















0















Is it possible to set the value of an excel control, for example a textbox or a radio button, with the EPPLUS-library?



We have an excel document that will be used as a template to create other excel files. With EPPLUS you can easily load the template, fill in cell values and save it as a new document like:



var excelPackage = new ExcelPackage(new System.IO.FileInfo(@"C:Template.xlsm"));
excelPackage.Workbook.Worksheets[0].Cells["B11"].Value = "Hello!";
excelPackage.SaveAs(new System.IO.FileInfo(@"C:NewDocument.xlsm"));


However, the excel template also contains textboxes and radiobuttons that we need to assign values to before saving.



We have previously used a non-free library called Spire.XLS to do this, but it's kind of overkill just to do this. Plus it would be nice to not have to deal with license files and such.



We also like to avoid the interop-library since you have to install office on the deployment server.



EPPLUS is a really nice library so if it is possible to use that to do this it would be really nice. If it doesn't support controls, would it be hard to extend it to support this?










share|improve this question























  • I'm not sure I understand so please correct me, you want to save your excel file as a template so that next time when you open a file based on this template all the values are filled by defaults. More precisely, you would like that the by default the radiobuttons and texboxes have the same values as the original file?

    – GTPV
    Nov 14 '18 at 14:53











  • No, the template should never be changed and the radios and textboxes are all empty in the template (not filled out). I only want to make filled out copies of the template. One solution would be to code the entire excel file from scratch with values and all, but the thing is that the template is a customer document that will be updated from time to time. So to avoid code changes every time the template changes (if it's layout changes or such) it is better to use their document as template and only supply the values for specific fields.

    – Fredrik Söderlund
    Nov 14 '18 at 15:47











  • You can loop over all the controls of a spreadsheet "for each ctrl in worksheet(name),controls", then give them a value "ctrl.value ='world' ". Additionally, in your loop, you can put if statements to make sure that only the proper controls are given a value.

    – GTPV
    Nov 14 '18 at 15:52













  • ok. Hmm, I can't find any property "Controls" in ExcelWorksheets. Are we still talking about EPPlus here? Or is some other library?

    – Fredrik Söderlund
    Nov 14 '18 at 16:31











  • There is a property "WorksheetXml" which seems to be the xml representation of the sheet. The xml contains a section "controls", but there is only one control. There should be several. Maybe the textboxes isn't controls but som other excel entity. The textboxes looks like grey resizeable and movable boxes where the user can input text.

    – Fredrik Söderlund
    Nov 14 '18 at 16:38














0












0








0








Is it possible to set the value of an excel control, for example a textbox or a radio button, with the EPPLUS-library?



We have an excel document that will be used as a template to create other excel files. With EPPLUS you can easily load the template, fill in cell values and save it as a new document like:



var excelPackage = new ExcelPackage(new System.IO.FileInfo(@"C:Template.xlsm"));
excelPackage.Workbook.Worksheets[0].Cells["B11"].Value = "Hello!";
excelPackage.SaveAs(new System.IO.FileInfo(@"C:NewDocument.xlsm"));


However, the excel template also contains textboxes and radiobuttons that we need to assign values to before saving.



We have previously used a non-free library called Spire.XLS to do this, but it's kind of overkill just to do this. Plus it would be nice to not have to deal with license files and such.



We also like to avoid the interop-library since you have to install office on the deployment server.



EPPLUS is a really nice library so if it is possible to use that to do this it would be really nice. If it doesn't support controls, would it be hard to extend it to support this?










share|improve this question














Is it possible to set the value of an excel control, for example a textbox or a radio button, with the EPPLUS-library?



We have an excel document that will be used as a template to create other excel files. With EPPLUS you can easily load the template, fill in cell values and save it as a new document like:



var excelPackage = new ExcelPackage(new System.IO.FileInfo(@"C:Template.xlsm"));
excelPackage.Workbook.Worksheets[0].Cells["B11"].Value = "Hello!";
excelPackage.SaveAs(new System.IO.FileInfo(@"C:NewDocument.xlsm"));


However, the excel template also contains textboxes and radiobuttons that we need to assign values to before saving.



We have previously used a non-free library called Spire.XLS to do this, but it's kind of overkill just to do this. Plus it would be nice to not have to deal with license files and such.



We also like to avoid the interop-library since you have to install office on the deployment server.



EPPLUS is a really nice library so if it is possible to use that to do this it would be really nice. If it doesn't support controls, would it be hard to extend it to support this?







excel epplus






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 14 '18 at 14:22









Fredrik SöderlundFredrik Söderlund

1




1













  • I'm not sure I understand so please correct me, you want to save your excel file as a template so that next time when you open a file based on this template all the values are filled by defaults. More precisely, you would like that the by default the radiobuttons and texboxes have the same values as the original file?

    – GTPV
    Nov 14 '18 at 14:53











  • No, the template should never be changed and the radios and textboxes are all empty in the template (not filled out). I only want to make filled out copies of the template. One solution would be to code the entire excel file from scratch with values and all, but the thing is that the template is a customer document that will be updated from time to time. So to avoid code changes every time the template changes (if it's layout changes or such) it is better to use their document as template and only supply the values for specific fields.

    – Fredrik Söderlund
    Nov 14 '18 at 15:47











  • You can loop over all the controls of a spreadsheet "for each ctrl in worksheet(name),controls", then give them a value "ctrl.value ='world' ". Additionally, in your loop, you can put if statements to make sure that only the proper controls are given a value.

    – GTPV
    Nov 14 '18 at 15:52













  • ok. Hmm, I can't find any property "Controls" in ExcelWorksheets. Are we still talking about EPPlus here? Or is some other library?

    – Fredrik Söderlund
    Nov 14 '18 at 16:31











  • There is a property "WorksheetXml" which seems to be the xml representation of the sheet. The xml contains a section "controls", but there is only one control. There should be several. Maybe the textboxes isn't controls but som other excel entity. The textboxes looks like grey resizeable and movable boxes where the user can input text.

    – Fredrik Söderlund
    Nov 14 '18 at 16:38



















  • I'm not sure I understand so please correct me, you want to save your excel file as a template so that next time when you open a file based on this template all the values are filled by defaults. More precisely, you would like that the by default the radiobuttons and texboxes have the same values as the original file?

    – GTPV
    Nov 14 '18 at 14:53











  • No, the template should never be changed and the radios and textboxes are all empty in the template (not filled out). I only want to make filled out copies of the template. One solution would be to code the entire excel file from scratch with values and all, but the thing is that the template is a customer document that will be updated from time to time. So to avoid code changes every time the template changes (if it's layout changes or such) it is better to use their document as template and only supply the values for specific fields.

    – Fredrik Söderlund
    Nov 14 '18 at 15:47











  • You can loop over all the controls of a spreadsheet "for each ctrl in worksheet(name),controls", then give them a value "ctrl.value ='world' ". Additionally, in your loop, you can put if statements to make sure that only the proper controls are given a value.

    – GTPV
    Nov 14 '18 at 15:52













  • ok. Hmm, I can't find any property "Controls" in ExcelWorksheets. Are we still talking about EPPlus here? Or is some other library?

    – Fredrik Söderlund
    Nov 14 '18 at 16:31











  • There is a property "WorksheetXml" which seems to be the xml representation of the sheet. The xml contains a section "controls", but there is only one control. There should be several. Maybe the textboxes isn't controls but som other excel entity. The textboxes looks like grey resizeable and movable boxes where the user can input text.

    – Fredrik Söderlund
    Nov 14 '18 at 16:38

















I'm not sure I understand so please correct me, you want to save your excel file as a template so that next time when you open a file based on this template all the values are filled by defaults. More precisely, you would like that the by default the radiobuttons and texboxes have the same values as the original file?

– GTPV
Nov 14 '18 at 14:53





I'm not sure I understand so please correct me, you want to save your excel file as a template so that next time when you open a file based on this template all the values are filled by defaults. More precisely, you would like that the by default the radiobuttons and texboxes have the same values as the original file?

– GTPV
Nov 14 '18 at 14:53













No, the template should never be changed and the radios and textboxes are all empty in the template (not filled out). I only want to make filled out copies of the template. One solution would be to code the entire excel file from scratch with values and all, but the thing is that the template is a customer document that will be updated from time to time. So to avoid code changes every time the template changes (if it's layout changes or such) it is better to use their document as template and only supply the values for specific fields.

– Fredrik Söderlund
Nov 14 '18 at 15:47





No, the template should never be changed and the radios and textboxes are all empty in the template (not filled out). I only want to make filled out copies of the template. One solution would be to code the entire excel file from scratch with values and all, but the thing is that the template is a customer document that will be updated from time to time. So to avoid code changes every time the template changes (if it's layout changes or such) it is better to use their document as template and only supply the values for specific fields.

– Fredrik Söderlund
Nov 14 '18 at 15:47













You can loop over all the controls of a spreadsheet "for each ctrl in worksheet(name),controls", then give them a value "ctrl.value ='world' ". Additionally, in your loop, you can put if statements to make sure that only the proper controls are given a value.

– GTPV
Nov 14 '18 at 15:52







You can loop over all the controls of a spreadsheet "for each ctrl in worksheet(name),controls", then give them a value "ctrl.value ='world' ". Additionally, in your loop, you can put if statements to make sure that only the proper controls are given a value.

– GTPV
Nov 14 '18 at 15:52















ok. Hmm, I can't find any property "Controls" in ExcelWorksheets. Are we still talking about EPPlus here? Or is some other library?

– Fredrik Söderlund
Nov 14 '18 at 16:31





ok. Hmm, I can't find any property "Controls" in ExcelWorksheets. Are we still talking about EPPlus here? Or is some other library?

– Fredrik Söderlund
Nov 14 '18 at 16:31













There is a property "WorksheetXml" which seems to be the xml representation of the sheet. The xml contains a section "controls", but there is only one control. There should be several. Maybe the textboxes isn't controls but som other excel entity. The textboxes looks like grey resizeable and movable boxes where the user can input text.

– Fredrik Söderlund
Nov 14 '18 at 16:38





There is a property "WorksheetXml" which seems to be the xml representation of the sheet. The xml contains a section "controls", but there is only one control. There should be several. Maybe the textboxes isn't controls but som other excel entity. The textboxes looks like grey resizeable and movable boxes where the user can input text.

– Fredrik Söderlund
Nov 14 '18 at 16:38












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53302395%2fcan-you-set-the-value-of-an-excel-control-with-epplus%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53302395%2fcan-you-set-the-value-of-an-excel-control-with-epplus%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python