<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <!--*** This is a generated file. Do not edit. ***--> <link rel="stylesheet" href="../skin/tigris.css" type="text/css"> <link rel="stylesheet" href="../skin/mysite.css" type="text/css"> <link rel="stylesheet" href="../skin/site.css" type="text/css"> <link media="print" rel="stylesheet" href="../skin/print.css" type="text/css"> <title>HSSF Use Cases</title> </head> <body bgcolor="white" class="composite"> <!--================= start Banner ==================--> <div id="banner"> <table width="100%" cellpadding="8" cellspacing="0" summary="banner" border="0"> <tbody> <tr> <!--================= start Group Logo ==================--> <td width="50%" align="left"> <div class="groupLogo"> <a href="http://poi.apache.org"><img border="0" class="logoImage" alt="Apache POI" src="../resources/images/group-logo.jpg"></a> </div> </td> <!--================= end Group Logo ==================--> <!--================= start Project Logo ==================--><td width="50%" align="right"> <div align="right" class="projectLogo"> <a href="http://poi.apache.org/"><img border="0" class="logoImage" alt="POI" src="../resources/images/project-logo.jpg"></a> </div> </td> <!--================= end Project Logo ==================--> </tr> </tbody> </table> </div> <!--================= end Banner ==================--> <!--================= start Main ==================--> <table width="100%" cellpadding="0" cellspacing="0" border="0" summary="nav" id="breadcrumbs"> <tbody> <!--================= start Status ==================--> <tr class="status"> <td> <!--================= start BreadCrumb ==================--><a href="http://www.apache.org/">Apache</a> | <a href="http://poi.apache.org/">POI</a><a href=""></a> <!--================= end BreadCrumb ==================--></td><td id="tabs"> <!--================= start Tabs ==================--> <div class="tab"> <span class="selectedTab"><a class="base-selected" href="../index.html">Home</a></span> | <script language="Javascript" type="text/javascript"> function printit() { if (window.print) { window.print() ; } else { var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH="0" HEIGHT="0" CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>'; document.body.insertAdjacentHTML('beforeEnd', WebBrowser); WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box WebBrowser1.outerHTML = ""; } } </script><script language="Javascript" type="text/javascript"> var NS = (navigator.appName == "Netscape"); var VERSION = parseInt(navigator.appVersion); if (VERSION > 3) { document.write(' <a title="PRINT this page OUT" href="javascript:printit()">PRINT</a>'); } </script> </div> <!--================= end Tabs ==================--> </td> </tr> </tbody> </table> <!--================= end Status ==================--> <table id="main" width="100%" cellpadding="8" cellspacing="0" summary="" border="0"> <tbody> <tr valign="top"> <!--================= start Menu ==================--> <td id="leftcol"> <div id="navcolumn"> <div class="menuBar"> <div class="menu"> <span class="menuLabel">Apache POI</span> <div class="menuItem"> <a href="../index.html">Top</a> </div> </div> <div class="menu"> <span class="menuLabel">HSSF+XSSF</span> <div class="menuItem"> <a href="index.html">Overview</a> </div> <div class="menuItem"> <a href="quick-guide.html">Quick Guide</a> </div> <div class="menuItem"> <a href="how-to.html">HOWTO</a> </div> <div class="menuItem"> <a href="converting.html">HSSF to SS Converting</a> </div> <div class="menuItem"> <a href="formula.html">Formula Support</a> </div> <div class="menuItem"> <a href="eval.html">Formula Evaluation</a> </div> <div class="menuItem"> <a href="eval-devguide.html">Eval Dev Guide</a> </div> <div class="menuItem"> <a href="examples.html">Examples</a> </div> <div class="menuItem"> <span class="menuSelected">Use Case</span> </div> <div class="menuItem"> <a href="diagrams.html">Pictorial Docs</a> </div> <div class="menuItem"> <a href="limitations.html">Limitations</a> </div> <div class="menuItem"> <a href="user-defined-functions.html">User Defined Functions</a> </div> <div class="menuItem"> <a href="excelant.html">ExcelAnt Tests</a> </div> </div> <div class="menu"> <span class="menuLabel">Contributer's Guide</span> <div class="menuItem"> <a href="hacking-hssf.html">Hacking HSSF</a> </div> <div class="menuItem"> <a href="record-generator.html">Record Generator</a> </div> <div class="menuItem"> <a href="chart.html">Charts</a> </div> </div> </div> </div> <form target="_blank" action="http://www.google.com/search" method="get"> <table summary="search" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img height="1" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap"> Search Apache POI<br> <input value="poi.apache.org" name="sitesearch" type="hidden"><input size="10" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../skin/images/spacer.gif" class="spacer"><input name="Search" value="GO" type="submit"></td><td><img height="1" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td> </tr> <tr> <td colspan="3"><img height="7" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td> </tr> <tr> <td class="bottom-left-thick"></td><td bgcolor="#a5b6c6"><img height="1" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td class="bottom-right-thick"></td> </tr> </table> </form> </td> <!--================= end Menu ==================--> <!--================= start Content ==================--><td> <div id="bodycol"> <div class="app"> <div align="center"> <h1>HSSF Use Cases</h1> </div> <div class="h3"> <a name="HSSF+Use+Cases"></a> <div class="h3"> <h3>HSSF Use Cases</h3> </div> <a name="Use+Case+1%3A+Read+existing+HSSF"></a> <div class="h4"> <h4>Use Case 1: Read existing HSSF</h4> </div> <p> <strong>Primary Actor:</strong> HSSF client</p> <p> <strong>Scope:</strong> HSSF</p> <p> <strong>Level:</strong> Summary</p> <p> <strong>Stakeholders and Interests:</strong> </p> <ul> <li>HSSF client- wants to read content of HSSF file</li> <li>HSSF - understands HSSF file</li> <li>POIFS - understands underlying POI file system</li> </ul> <p> <strong>Precondition:</strong> None</p> <p> <strong>Minimal Guarantee:</strong> None</p> <p> <strong>Main Success Guarantee:</strong> </p> <ol> <li>HSSF client requests HSSF to read a HSSF file, providing an InputStream containing HSSF file in question.</li> <li>HSSF requests POIFS to read the HSSF file, passing the InputStream object to POIFS (POIFS use case 1, read existing file system)</li> <li>HSSF reads the "Workbook" file (use case 4, read workbook entry)</li> </ol> <p> <strong>Extensions:</strong> </p> <p>2a. Exceptions thrown by POIFS will be passed on to the HSSF client.</p> <a name="Use+Case+2%3A+Write+HSSF+file"></a> <div class="h4"> <h4>Use Case 2: Write HSSF file</h4> </div> <p> <strong>Primary Actor:</strong> HSSF client</p> <p> <strong>Scope:</strong> HSSF</p> <p> <strong>Level:</strong> Summary</p> <p> <strong>Stakeholders and Interests:</strong> </p> <ul> <li>HSSF client- wants to write file out.</li> <li>HSSF - knows how to write file out.</li> <li>POIFS - knows how to write file system out.</li> </ul> <p> <strong>Precondition:</strong> </p> <ul> <li>File has been read (use case 1, read existing HSSF file) and subsequently modified or file has been created (use case 3, create HSSF file)</li> </ul> <p> <strong>Minimal Guarantee:</strong> None</p> <p> <strong>Main Success Guarantee:</strong> </p> <ol> <li>HSSF client provides an OutputStream to write the file to.</li> <li>HSSF writes the "Workbook" to its associated POIFS file system (use case 5, write workbook entry)</li> <li>HSSF requests POIFS to write its file system out, using the OutputStream obtained from the HSSF client (POIFS use case 2, write file system).</li> </ol> <p> <strong>Extensions:</strong> </p> <p>3a. Exceptions from POIFS are passed to the HSSF client.</p> <a name="Use+Case+3%3ACreate+HSSF+file"></a> <div class="h4"> <h4>Use Case 3:Create HSSF file</h4> </div> <p> <strong>Primary Actor:</strong> HSSF client</p> <p> <strong>Scope:</strong> HSSF</p> <p> <strong>Level:</strong> Summary</p> <p> <strong>Stakeholders and Interests:</strong> </p> <ul> <li>HSSF client- wants to create a new file.</li> <li>HSSF - knows how to create a new file.</li> <li>POIFS - knows how to creat a new file system.</li> </ul> <p> <strong>Precondition:</strong> </p> <p> <strong>Minimal Guarantee:</strong> None</p> <p> <strong>Main Success Guarantee:</strong> </p> <ol> <li>HSSF requests POIFS to create a new file system (POIFS use case 3, create new file system)</li> </ol> <p> <strong>Extensions:</strong> None</p> <a name="Use+Case+4%3A+Read+workbook+entry"></a> <div class="h4"> <h4>Use Case 4: Read workbook entry</h4> </div> <p> <strong>Primary Actor:</strong> HSSF</p> <p> <strong>Scope:</strong> HSSF</p> <p> <strong>Level:</strong> Summary</p> <p> <strong>Stakeholders and Interests:</strong> </p> <ul> <li>HSSF - knows how to read the workbook entry</li> <li>POIFS - knows how to manage the file system.</li> </ul> <p> <strong>Precondition:</strong> </p> <ul> <li>The file system has been read (use case 1, read existing HSSF file) or has been created and written to (use case 3, create HSSF file system; use case 5, write workbook entry).</li> </ul> <p> <strong>Minimal Guarantee:</strong> None</p> <p> <strong>Main Success Guarantee:</strong> </p> <ol> <li> HSSF requests POIFS for the "Workbook" file</li> <li>POIFS returns an InputStream for the file.</li> <li>HSSF reads from the InputStream provided by POIFS</li> <li>HSSF closes the InputStream provided by POIFS</li> </ol> <p> <strong>Extensions:</strong> </p> <p>3a. Exceptions thrown by POIFS will be passed on</p> <a name="Use+Case+5%3A+Write+workbook+entry"></a> <div class="h4"> <h4>Use Case 5: Write workbook entry</h4> </div> <p> <strong>Primary Actor:</strong> HSSF</p> <p> <strong>Scope:</strong> HSSF</p> <p> <strong>Level:</strong> Summary</p> <p> <strong>Stakeholders and Interests:</strong> </p> <ul> <li>HSSF - knows how to manage the write the workbook entry.</li> <li>POIFS - knows how to manage the file system.</li> </ul> <p> <strong>Precondition:</strong> </p> <ul> <li>Either an existing HSSF file has been read (use case 1, read existing HSSF file) or an HSSF file has been created (use case 3, create HSSF file).</li> </ul> <p> <strong>Minimal Guarantee:</strong> None</p> <p> <strong>Main Success Guarantee:</strong> </p> <ol> <li>HSSF checks the POIFS file system directory for the "Workbook" file (POIFS use case 8, read file system directory)</li> <li>If "Workbook" is in the directory, HSSF requests POIFS to replace it with the new workbook entry (POIFS use case 4, replace file in file system). Otherwise, HSSF requests POIFS to write the new workbook file, with the name "Workbook" (POIFS use case 6, write new file to file system)</li> </ol> <p> <strong>Extensions:</strong>None</p> <div id="authors" align="right">by Marc Johnson</div> </div> </div> </div> </td> <!--================= end Content ==================--> </tr> </tbody> </table> <!--================= end Main ==================--> <!--================= start Footer ==================--> <div id="footer"> <table summary="footer" cellspacing="0" cellpadding="4" width="100%" border="0"> <tbody> <tr> <!--================= start Copyright ==================--> <td colspan="2"> <div align="center"> <div class="copyright"> Copyright © 2002-2012 The Apache Software Foundation. All rights reserved.<br> Apache POI, POI, Apache, the Apache feather logo, and the Apache POI project logo are trademarks of The Apache Software Foundation. </div> </div> </td> <!--================= end Copyright ==================--> </tr> <tr> <td align="left"> <!--================= start Host ==================--> <!--================= end Host ==================--></td><td align="right"> <!--================= start Credits ==================--> <div align="right"> <div class="credit"></div> </div> <!--================= end Credits ==================--> </td> </tr> </tbody> </table> </div> <!--================= end Footer ==================--> </body> </html>