package tablib // HTML returns the HTML representation of the Dataset as an Exportable. func (d *Dataset) HTML() *Exportable { back := d.Records() b := newBuffer() b.WriteString("\n\t") for i, r := range back { b.WriteString("\n\t\t") for _, c := range r { tag := "td" if i == 0 { tag = "th" } b.WriteString("\n\t\t\t<" + tag + ">") b.WriteString(c) b.WriteString("") } b.WriteString("\n\t\t") if i == 0 { b.WriteString("\n\t\n\t") } } b.WriteString("\n\t\n
") return newExportable(b) } // HTML returns a HTML representation of the Databook as an Exportable. func (d *Databook) HTML() *Exportable { b := newBuffer() for _, s := range d.sheets { b.WriteString("

" + s.title + "

\n") b.Write(s.dataset.HTML().Bytes()) b.WriteString("\n\n") } return newExportable(b) }