Hey guys,
Just trying to increase my programming ability atm so any help would be much appreciate.
In my asp.net project i've used (aspx)
(aspx.cs)
This works fine but it displays the excel file as a big lump of text clumped together, I would appreciate it if someone could give me a tip or somewhere to get started on how to display the output in a nice table
thank you
Just trying to increase my programming ability atm so any help would be much appreciate.
In my asp.net project i've used (aspx)
<asp:Panel ID="Excel" runat="server">
</asp:Panel>
(aspx.cs)
ExcelFile ef = new ExcelFile();
string fileName = @"C:\\location of excel doc";
ef.LoadXlsx(fileName, XlsxOptions.PreserveMakeCopy);
StringBuilder sb = new StringBuilder();
foreach (ExcelWorksheet sheet in ef.Worksheets)
{
sb.AppendLine();
sb.AppendFormat("------{0}--------", sheet.Name);
foreach (ExcelRow row in sheet.Rows)
{
sb.AppendLine();
foreach (ExcelCell cell in row.AllocatedCells)
{
if (cell.Value != null)
{
Label x = new Label();
x.Text = cell.Value.ToString();
Excel.Controls.Add(x);
sb.AppendFormat("{0}({1})", cell.Value, cell.Value.GetType().Name);
sb.Append("\t");
}
}
}
}
Console.WriteLine(sb.ToString());
This works fine but it displays the excel file as a big lump of text clumped together, I would appreciate it if someone could give me a tip or somewhere to get started on how to display the output in a nice table
thank you