How can we display table border on a Open Office Calc sheet thro HTML?
Ours is a ASP.NET web application. I am generating Calc on the fly without saving it in the server and sending that to client(browser). For that, I am generating and sending HTML code through Response object to the browser. As Content-Type is set to "application/vnd.sun.xml.calc", browser treats it as an attachement and Open Office renders the HTML code. But I am having trouble displaying Table border on the Calc spreadsheet. As a note, this works fine if the attachment type is MS Excel. I noticed, Calc does not support all HTML tags. In this regard, I would like to know how can I display Table border in Calc thro my HTML content of Response object.
Below is the code snippet
protected void Page_Load(object sender, EventArgs e)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=Sample.sxc");
HttpContext.Current.Response.Charset = "";
HttpContext.Current.Response.ContentType = "application/vnd.sun.xml.calc";
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
StringBuilder style = new StringBuilder();
style.Append(@"<style> ");
style.Append(@" .text { mso-number-format:\@; } ");
style.Append(@" .num { mso-number-format:\#\,\#\#0\.00; } ");
style.Append(@" .intg { mso-number-format:\#\,\#\#0; } ");
style.Append(@" .date { mso-number-format: 'Short Date'; } ");
style.Append(@" .date { mso-number-format: 'dd\/mm\/yyyy'; } ");
style.Append(@"</style>");
HttpContext.Current.Response.Write(style.ToString());
string s = @" <TABLE BORDER=""1"">
<TR>
<TD> <P> <U> <B> For Testing </B> </U> <BR> Generated By Sameer Bondasgfgzff </BR> </P>
</TD>
</TR>
<TR>
<TD width=""100px""> Sameer </TD>
</TR>
<TR> <TD width=""100px""> Srinivas </TD>
</TR>
</TABLE>"
;
HttpContext.Current.Response.Output.Write(s);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
}
Since, I could not figure out, I tried creating explicitly a Calc sheet with border. However, upon saving that as .HTML, I get a warning message saying formatting will be disturbed. If I suppress that and save it as .HTML, and when I open the saved .HTML thro Calc, border around the table dissapears.
I want to know how can I display border for the table in Calc sheet of Open Office thro HTML. Thanks in advance.