private void generateWordDoc(String docName) throws FileNotFoundException, IOException {
    XWPFDocument doc = new XWPFDocument();
    for (Theme t : themes) {
      for (Keyword k : t.getKeywords()) {
        for (Occurrence c : k.getOccurrs()) {
          XWPFParagraph p = doc.createParagraph();
          p.setAlignment(ParagraphAlignment.LEFT);
          XWPFRun r = p.createRun();
          setRunAttributes(r);
          r.setText(c.getOccurInfo());
          r.addCarriageReturn();

          String[] strings = c.getSentece().split(k.getName());
          for (int i = 0; i < strings.length; i++) {
            XWPFRun r2 = p.createRun();
            setRunAttributes(r2);
            r2.setText(strings[i]);

            if (i < strings.length - 1) {
              XWPFRun r3 = p.createRun();
              setRunAttributes(r3);
              r3.setBold(true);
              r3.setItalic(true);
              r3.setColor(t.getHexColor());
              r3.setText(k.getName());
            }
          }
        }
      }
    }
    FileOutputStream outStream = new FileOutputStream(docName);
    doc.write(outStream);
    outStream.close();
  }
 // There has to be a more efficient way to do this
 // Perhaps hashtables
 private void checkForKeywords(String fileName, String line, int loc) {
   for (Theme t : themes) {
     for (Keyword k : t.getKeywords()) {
       if (line.contains(k.getName())) k.addOccurrence(fileName, line, loc);
     }
   }
   lineCount++;
 }
  private void generateExcelDoc(String docName) throws FileNotFoundException, IOException {
    XSSFWorkbook workbook = new XSSFWorkbook();
    XSSFSheet overall = workbook.createSheet("Overall");
    XSSFRow row = overall.createRow(0);

    XSSFCellStyle topStyle = workbook.createCellStyle();
    topStyle.setAlignment(CellStyle.ALIGN_CENTER);

    XSSFCell theme = row.createCell(0);
    theme.setCellValue("Theme");
    overall.autoSizeColumn(0);

    XSSFCell occurs = row.createCell(1);
    occurs.setCellValue("Occurrences");
    overall.autoSizeColumn(1);

    XSSFCell prev = row.createCell(2);
    prev.setCellValue("Prevalence");
    overall.autoSizeColumn(2);

    theme.setCellStyle(topStyle);
    occurs.setCellStyle(topStyle);
    prev.setCellStyle(topStyle);

    for (int i = 0; i < themes.size(); i++) {
      XSSFRow r = overall.createRow((i + 1));

      XSSFCell c = r.createCell(0);
      c.setCellValue(themes.get(i).getName());

      XSSFCell c1 = r.createCell(1);
      c1.setCellValue(themes.get(i).getTotalOccurs());

      XSSFCell c2 = r.createCell(2);
      c2.setCellValue(calculatePrevalence(themes.get(i).getTotalOccurs(), lineCount));
    }

    // This could be done in the previous loop but since we don't need
    // indices as much, we may as well use the cleaner for each loop

    for (Theme t : themes) {
      XSSFSheet themeSheet = workbook.createSheet(t.getName());
      XSSFRow row1 = themeSheet.createRow(0);

      XSSFCell keyword = row1.createCell(0);
      keyword.setCellValue("Keyword");
      keyword.setCellStyle(topStyle);

      XSSFCell occ = row1.createCell(1);
      occ.setCellValue("Occurrences");
      occ.setCellStyle(topStyle);

      XSSFCell themePrev = row1.createCell(2);
      themePrev.setCellValue("Prevalence");
      themePrev.setCellStyle(topStyle);

      for (int i = 0; i < t.getKeywords().size(); i++) {
        Keyword k = t.getKeywords().get(i);
        XSSFRow r = themeSheet.createRow((i + 1));

        XSSFCell c = r.createCell(0);
        c.setCellValue(k.getName());

        XSSFCell c1 = r.createCell(1);
        c1.setCellValue(k.getNumOccurs());

        XSSFCell c2 = r.createCell(2);
        c2.setCellValue(calculatePrevalence(k.getNumOccurs(), t.getTotalOccurs()));
      }
    }

    FileOutputStream output = new FileOutputStream(docName);
    workbook.write(output);
    output.close();
  }