0
이 코드를 사용하여 Excel 파일을 내보내고 있습니다. 그것은 잘 작동합니다. 내 보낸 파일에 테두리를 적용하는 방법은 무엇입니까?
public void WriteHtmlTable<T>(IEnumerable<T> data, TextWriter output)
{
using (StringWriter sw = new StringWriter())
{
using (HtmlTextWriter htw = new HtmlTextWriter(sw))
{
Table table = new Table();
TableRow row = new TableRow();
PropertyDescriptorCollection props = TypeDescriptor.GetProperties(typeof(T));
foreach (PropertyDescriptor prop in props)
{
TableCell cell = new TableCell();
cell.Text = prop.Name;
row.Cells.Add(cell);
}
table.Rows.Add(row);
foreach (T item in data)
{
row = new TableRow();
foreach (PropertyDescriptor prop in props)
{
TableCell cell = new TableCell();
cell.Text = prop.Converter.ConvertToString(prop.GetValue(item));
row.Cells.Add(cell);
}
table.Rows.Add(row);
}
table.RenderControl(htw);
output.Write(sw.ToString());
}
}
}
나에게 내가 원하는 이 출력
하지만 출력을 제공 모든 행과 columns.what 변화가 내 코드에서해야 할이
내가 경계를 원하는 것입니다 ?? 미리 감사드립니다 ...
을 Excel을 실제 Excel 파일을하지 쓰는 HTML을 출력하고 호출하여. 또는 정말로 필요한 경우 적절한 CSS를 적용하여 그렇게 할 수 있습니다. – CodeCaster
html을 출력하고 jquery에서 Excel 파일을 호출하고 있습니다. – akash
예. 좋습니다. HTML은 Excel이 아닙니다. – CodeCaster