Click here to Skip to main content
15,849,907 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have installed EPPlus in my references using the NuGet dialog but when I go to use it, I get an error saying I need to set up the licence with

ExcelPackage.LicenseContext = LicenseContext.NonCommercial;


I can not figure out where to put this.

This is probably a basic question, but I can't figure it out.

What I have tried:

Reading the EPPlus documentation
Searcing google
Putting it above the code
Putting it with the
InitializeComponent();
Putting it as a using statement
Posted
Updated 4-Aug-22 15:42pm

Your question should have been directed to EPPlus.

Developers - EPPlus Software[^]. Notice the "Support" section at the bottom of that page?
 
Share this answer
 
I'd use app.config file:

XML
<appSettings>
    <!--The license context used-->
    <add key="EPPlus:ExcelPackage.LicenseContext" value="NonCommercial" />
</appSettings>


More details here: License Exception
 
Share this answer
 
I took the ungraceful way

sourceWorkbook = objArchive.Workbooks.Open(strSourceFile);
     sourceWorkbook.SaveAs(strDestinationFile);
     sourceWorkbook.Close();
     destinationWorkbook = objArchive.Workbooks.Open(strDestinationFile, misValue, false);
 
Share this answer
 
Comments
Richard Deeming 5-Aug-22 9:06am    
Your two "solutions" have nothing to do with the question you've posted them to.
I gave up, for now, and may return to it at a later date.
 
Share this answer
 
Comments
Richard Deeming 5-Aug-22 9:06am    
And this one is definitely not a "solution", even if you had posted it to the correct question.
PaulaJoannAllen 5-Aug-22 12:53pm    
I looked on the EPPlus website and to get in for questions or answers, you must be a paying member. I am new to this, so I would need my handheld.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900