"ExportToDataGridView" .NET GemBox 中不存在
"ExportToDataGridView" Does not exist in .NET GemBox
我一直在试图找出发生这种情况的原因,但出于某种原因 gembox.spreadsheet.winformutilities 的 .net 不会在代码上提供导出 DataGridView:
using System.Windows.Forms;
using GemBox.Spreadsheet;
using GemBox.Spreadsheet.WinFormsUtilities;namespace Excel
{
public partial class UserControl1 : UserControl
{
private void bunifuFlatButton2_Click(object sender, EventArgs e)
{
OpenFileDialog open = new OpenFileDialog();
open.Filter = "Al files (*.*)|*.*|";
open.FilterIndex = 1;
if (open.ShowDialog()== DialogResult.OK)
{
ExcelFile ef = new ExcelFile();
ExcelWorksheet ws = ef.Worksheets.Add("Export");
DataGridViewConverter.***ExportToDataGridView***(ef.Worksheets.ActiveWorksheet, this.dataGridView1, new ExportToDataGridViewOptions() { ColumnHeaders = true });
}
}
}
}
提前感谢您的回答!
由于名称冲突而出现问题:
namespace Excel
{
public partial class UserControl1 : UserControl
{
public static class DataGridViewConverter
{
}
}
}
所以有两个class同名:
Excel.UserControl1.DataGridViewConverter
GemBox.Spreadsheet.WinFormsUtilities.DataGridViewConverter
解决方案是使用 class 的全名,或者您可以定义一个别名,例如:
// ...
using System.Windows.Forms;
using GemBox.Spreadsheet;
using GemBoxDataGridViewConverter = GemBox.Spreadsheet.WinFormsUtilities.DataGridViewConverter;
namespace Excel
{
public partial class UserControl1 : UserControl
{
private void bunifuFlatButton2_Click(object sender, EventArgs e)
{
GemBoxDataGridViewConverter.ExportToDataGridView(...);
}
}
}
另外,作为参考,您可以从 GitHub or check the Windows Forms 在线示例下载工作示例。
我一直在试图找出发生这种情况的原因,但出于某种原因 gembox.spreadsheet.winformutilities 的 .net 不会在代码上提供导出 DataGridView:
using System.Windows.Forms;
using GemBox.Spreadsheet;
using GemBox.Spreadsheet.WinFormsUtilities;namespace Excel
{
public partial class UserControl1 : UserControl
{
private void bunifuFlatButton2_Click(object sender, EventArgs e)
{
OpenFileDialog open = new OpenFileDialog();
open.Filter = "Al files (*.*)|*.*|";
open.FilterIndex = 1;
if (open.ShowDialog()== DialogResult.OK)
{
ExcelFile ef = new ExcelFile();
ExcelWorksheet ws = ef.Worksheets.Add("Export");
DataGridViewConverter.***ExportToDataGridView***(ef.Worksheets.ActiveWorksheet, this.dataGridView1, new ExportToDataGridViewOptions() { ColumnHeaders = true });
}
}
}
}
提前感谢您的回答!
由于名称冲突而出现问题:
namespace Excel
{
public partial class UserControl1 : UserControl
{
public static class DataGridViewConverter
{
}
}
}
所以有两个class同名:
Excel.UserControl1.DataGridViewConverter
GemBox.Spreadsheet.WinFormsUtilities.DataGridViewConverter
解决方案是使用 class 的全名,或者您可以定义一个别名,例如:
// ...
using System.Windows.Forms;
using GemBox.Spreadsheet;
using GemBoxDataGridViewConverter = GemBox.Spreadsheet.WinFormsUtilities.DataGridViewConverter;
namespace Excel
{
public partial class UserControl1 : UserControl
{
private void bunifuFlatButton2_Click(object sender, EventArgs e)
{
GemBoxDataGridViewConverter.ExportToDataGridView(...);
}
}
}
另外,作为参考,您可以从 GitHub or check the Windows Forms 在线示例下载工作示例。