title: iText HTML with embedded CSS
body: <p>I'm working on a table export interface to export to HTML, PDF and RTF. I'm using iText for this because it allows very similar handling of the three types.</p>
  
  <p>Simple example for HTML export:</p>
  
  <pre><code>final Document document = new Document(PageSize.A4, 50, 50, 50, 50);
  HtmlWriter writer = HtmlWriter.getInstance(document, outputStream);
  Table actTable = new Table(colCount);
  final Cell c = new Cell(cellString);
  
  c.setColspan(colSpan);
  c.setHeader(isHeader);
  
  actTable.addCell(c);
  writer.add(actTable);
  </code></pre>
  
  <p>The base version is working so far and I want to style the elements now.</p>
  
  <p>In the former export class I used an embedded stylesheet:</p>
  
  <pre><code>  String cssFileContent = IOUtils.toString(new FileInputStream("style.css"));
  
    final StringBuilder sb = new StringBuilder();
  
    sb.append("&lt;!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"&gt;\n");
    sb.append("&lt;meta http-equiv='Content-Type' content='text/html;charset=ISO-8859-1'&gt;\n");
    sb.append("&lt;html xmlns=\"http://www.w3.org/1999/xhtml\"&gt;\n");
    sb.append("&lt;head&gt;\n&lt;title&gt;");
    sb.append(title);
    sb.append("&lt;/title&gt;\n");
    sb.append("&lt;style media='screen' type='text/css'&gt;\n");
    sb.append(cssFileContent); // embed the stylesheet
    sb.append("&lt;/style&gt;");
    sb.append("&lt;div id=\"header\"&gt;&lt;/div&gt;\n");
    sb.append("&lt;/head&gt;\n");
    sb.append("&lt;body&gt;\n");
    ...
  </code></pre>
  
  <p>Now I am trying to add a style element with iText but can not figure out how to do that. Please help!</p>
  
  <p>My second question: How can I prevent iText from creating a <code>div</code> tag for every cell?</p>
  
  <pre><code>&lt;tr&gt;
    &lt;td border="0.5" width="0"&gt;
      &lt;div&gt;testA0,0
      &lt;/div&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>