You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by Apache Wiki <wi...@apache.org> on 2007/01/20 15:30:35 UTC

[Myfaces Wiki] Update of "Exporting DataTable To MS-Excel" by AlexeyChystoprudov

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.

The following page has been changed by AlexeyChystoprudov:
http://wiki.apache.org/myfaces/Exporting_DataTable_To_MS-Excel

The comment on the change is:
fixed wrong htmlparser call. Added some comments about columnclass attribute

------------------------------------------------------------------------------
          try{
  
              htmlBuffer = "<html>" + htmlBuffer + "</html>";
-             Parser parser = new Parser(htmlBuffer);
+             Parser parser = new Parser();
-             parser.setInputHTML("html");
+             parser.setInputHTML(htmlBuffer);
              NodeList nodelist = parser.parse(null);
              Node node = nodelist.elementAt(0);
              
@@ -217, +217 @@

                      htmlRow = htmlRow.replace("<th></th>","<th> </th>");
                      htmlRow = htmlRow.replace("<TH></TH>","<th> </th>");
                      splitHtmlRow = pu.splitTags(htmlRow, new String[] {"tr", "th", "a"}, true, false);
+                     /*if your column headers don't links use 
+                      splitHtmlRow = pu.splitTags(htmlRow, new String[] {"tr", "th"}, true, false); */
                      colCount = splitHtmlRow.length;
                  } else if(i == 1 && footList.size() == 1){
                      row = sheet.createRow((short) rowList.size() - 1);
@@ -236, +238 @@

                      
                      htmlRow = htmlRow.replace("<td></td>","<td> </td>");
                      htmlRow = htmlRow.replace("<TD></TD>","<td> </td>");
+                     //if your h:dataTable has columnclass attribute uncomment 2 lines below
+                     //htmlRow = htmlRow.replace("</span>", " </span>");
+                     //splitHtmlRow = ParserUtils.splitTags(htmlRow, new String[]{"tr", "td", "span"}, true, false);
                      splitHtmlRow = pu.splitTags(htmlRow, new String[] {"tr", "td"}, true, false);
                      colCount = splitHtmlRow.length;
                  }