Die EPPLUS -Lizenz kann nicht auf Non -Commercial festgelegt werden, ohne dass der Code brechen kann, da "licenseContextC#

Ein Treffpunkt für C#-Programmierer
Anonymous
 Die EPPLUS -Lizenz kann nicht auf Non -Commercial festgelegt werden, ohne dass der Code brechen kann, da "licenseContext

Post by Anonymous »

Ich versuche, Text in einer Etikett in Windows -Formularen mit epplus in eine Excel -Datei umzuwandeln

Code: Select all

OfficeOpenXml.LicenseContext = OfficeOpenXml.LicenseContext.NonCommercial;< /code> < /p>
wird verwendet.OfficeOpenXml.LicenseContext = LicenseContext.NonCommercial;< /code>
Es gibt jedoch Fehler 'licenceContext ist ein Typ, aber als Variable' und 'liceneContext' ist eine eindeutige Referenz zwischen 'system.comPonentModel.licenSecontext' und 'OfficeOpenxml.LicenSecontext'. Beide erscheinen dann.  Ich bin sehr neu in Epplus und bin mir nicht sicher, ob es etwas gibt, das mir < /p>
hier fehlt.using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using OfficeOpenXml;

namespace Converting_txt_file_to_xlsx
{
public partial class Form1 : Form
{
OpenFileDialog filechooser = new OpenFileDialog();

public Form1()
{
InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)
{
if (filechooser.ShowDialog() == DialogResult.OK)
{
// Check if the file exists before trying to open it
if (File.Exists(filechooser.FileName))
{
// Enclose the StreamReader in a using block to ensure proper closing and disposing
using (StreamReader fileReader = new StreamReader(filechooser.FileName, Encoding.UTF8))
{
string inputrecord = fileReader.ReadToEnd();

// Display the content in the TextFile control
label1.Text = inputrecord;
}
}
}

}

private void btnSaveToExcel_Click_1(object sender, EventArgs e)
{
// Get the text from the label and split it into lines
string labelText = label1.Text;
string[] lines = labelText.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
label1.Text = "program started...";
OfficeOpenXml.LicenseContext = LicenseContext.NonCommercial;

// Create a new Excel package and add a worksheet
using (var package = new ExcelPackage())
{
var worksheet = package.Workbook.Worksheets.Add("Data");

// Write each line of text to a separate cell
for (int row = 1; row

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post