<typedef resource="org/apache/poi/ss/excelant/antlib.xml" classpathref="excelant.path" />\r
]]></source>\r
<p>\r
- Where excelant.path referes to the classpath with POI jars.\r
+ Where excelant.path refers to the classpath with POI jars.\r
Using this approach the provided extensions will live in the default namespace. Note that the default task/typenames (evaluate, test) may be too generic and should either be explicitly overridden or used with a namespace.\r
</p>\r
<ul><li>Similar, but assigning a namespace URI:</li></ul> \r
CreationHelper createHelper = wb.getCreationHelper();
//cell style for hyperlinks
- //by default hypelrinks are blue and underlined
+ //by default hyperlinks are blue and underlined
CellStyle hlink_style = wb.createCellStyle();
Font hlink_font = wb.createFont();
hlink_font.setUnderline(Font.U_SINGLE);
public static void main(String[]args) throws Exception{
Workbook wb = new XSSFWorkbook(); //or new HSSFWorkbook();
- CreationHelper createHelper = wb.getCreationHelper();
-
- //cell style for hyperlinks
- //by default hypelrinks are blue and underlined
- CellStyle hlink_style = wb.createCellStyle();
- Font hlink_font = wb.createFont();
- hlink_font.setUnderline(Font.U_SINGLE);
+ CreationHelper createHelper = wb.getCreationHelper();\r
+\r
+ //cell style for hyperlinks\r
+ //by default hyperlinks are blue and underlined\r
+ CellStyle hlink_style = wb.createCellStyle();\r
+ Font hlink_font = wb.createFont();\r
+ hlink_font.setUnderline(Font.U_SINGLE);\r
hlink_font.setColor(IndexedColors.BLUE.getIndex());
hlink_style.setFont(hlink_font);
*/
public interface Hyperlink {
/**
- * Link to a existing file or web page
+ * Link to an existing file or web page
*/
public static final int LINK_URL = 1;
/**
- * Hypelink address. Depending on the hyperlink type it can be URL, e-mail, patrh to a file, etc.
+ * Hyperlink address. Depending on the hyperlink type it can be URL, e-mail, path to a file, etc.
*
* @return the address of this hyperlink
*/
public String getAddress();
/**
- * Hypelink address. Depending on the hyperlink type it can be URL, e-mail, patrh to a file, etc.
+ * Hyperlink address. Depending on the hyperlink type it can be URL, e-mail, path to a file, etc.
*
* @param address the address of this hyperlink
*/
*
* @author Yegor Kozlov (yegor at apache dot org)
*/
-public class HSSFHyperlink implements Hyperlink {
-
- /**
- * Link to a existing file or web page
- */
- public static final int LINK_URL = 1;
-
+public class HSSFHyperlink implements Hyperlink {\r
+\r
+ /**\r
+ * Link to an existing file or web page\r
+ */\r
+ public static final int LINK_URL = 1;\r
+\r
/**
* Link to a place in this document
*/
/**
* Low-level record object that stores the actual hyperlink data
*/
- protected HyperlinkRecord record = null;
-
- /**
- * If we create a new hypelrink remember its type
- */
- protected int link_type;
-
+ protected HyperlinkRecord record = null;\r
+\r
+ /**\r
+ * If we create a new hyperlink remember its type\r
+ */\r
+ protected int link_type;\r
+\r
/**
* Construct a new hyperlink
*
*/
public void setLastColumn(int col){
record.setLastColumn((short)col);
- }
-
- /**
- * Hypelink address. Depending on the hyperlink type it can be URL, e-mail, path to a file, etc.
- *
- * @return the address of this hyperlink
- */
+ }\r
+\r
+ /**\r
+ * Hyperlink address. Depending on the hyperlink type it can be URL, e-mail, path to a file, etc.\r
+ *\r
+ * @return the address of this hyperlink\r
+ */\r
public String getAddress(){
return record.getAddress();
}
return record.getTextMark();
}
- /**
- * Convenience method equivalent to {@link #setAddress(String)}
- *
- * @param textMark the place in worksheet this hypelrink referes to, e.g. 'Target Sheet'!A1'
- */
- public void setTextMark(String textMark) {
- record.setTextMark(textMark);
+ /**\r
+ * Convenience method equivalent to {@link #setAddress(String)}\r
+ *\r
+ * @param textMark the place in worksheet this hyperlink refers to, e.g. 'Target Sheet'!A1'\r
+ */\r
+ public void setTextMark(String textMark) {\r
+ record.setTextMark(textMark);\r
}
public String getShortFilename(){
return record.getShortFilename();
}
- /**
- * Convenience method equivalent to {@link #setAddress(String)}
- *
- * @param shortFilename the path to a file this hypelrink points to, e.g. 'readme.txt'
- */
- public void setShortFilename(String shortFilename) {
- record.setShortFilename(shortFilename);
- }
-
- /**
- * Hypelink address. Depending on the hyperlink type it can be URL, e-mail, patrh to a file, etc.
- *
- * @param address the address of this hyperlink
- */
+ /**\r
+ * Convenience method equivalent to {@link #setAddress(String)}\r
+ *\r
+ * @param shortFilename the path to a file this hyperlink points to, e.g. 'readme.txt'\r
+ */\r
+ public void setShortFilename(String shortFilename) {\r
+ record.setShortFilename(shortFilename);\r
+ }\r
+\r
+ /**\r
+ * Hyperlink address. Depending on the hyperlink type it can be URL, e-mail, path to a file, etc.\r
+ *\r
+ * @param address the address of this hyperlink\r
+ */\r
public void setAddress(String address){
record.setAddress(address);
}
}
/**
- * Assign a hypelrink to this cell
+ * Assign a hyperlink to this cell
*
- * @param hyperlink the hypelrink to associate with this cell
+ * @param hyperlink the hyperlink to associate with this cell
*/
public void setHyperlink(Hyperlink hyperlink) {
XSSFHyperlink link = (XSSFHyperlink)hyperlink;
}
/**
- * Hypelink address. Depending on the hyperlink type it can be URL, e-mail, path to a file
+ * Hyperlink address. Depending on the hyperlink type it can be URL, e-mail, path to a file
*
* @return the address of this hyperlink
*/
<record id="0x1051" name="LinkedData" excel-record-id="AI" package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
- <description>Describes a linked data record. This record referes to the series data or text.</description>
+ <description>Describes a linked data record. This record refers to the series data or text.</description>
<author>Glen Stampoultzis (glens at apache.org)</author>
<fields>
<field type="int" size="1" name="link type" description="What type of link is this?">
/**
* Create a new Picture and populate the inital structure of the <code>EscherSp</code> record which holds information about this picture.
- * @param idx the index of the picture which referes to <code>EscherBSE</code> container.
+ * @param idx the index of the picture which refers to <code>EscherBSE</code> container.
* @return the create Picture object
*/
protected EscherContainerRecord createSpContainer(int idx, boolean isChild) {
sheet.shiftRows(sheet.getFirstRowNum(), sheet.getLastRowNum(), 2);
//cells A3 and A4 don't contain hyperlinks anymore
- assertNull(sheet.getRow(2).getCell(0).getHyperlink());
- assertNull(sheet.getRow(3).getCell(0).getHyperlink());
-
- //the first hypelink now belongs to A5
- HSSFHyperlink link1_shifted = sheet.getRow(2+2).getCell(0).getHyperlink();
- assertNotNull(link1_shifted);
- assertEquals(4, link1_shifted.getFirstRow());
- assertEquals(4, link1_shifted.getLastRow());
-
- //the second hypelink now belongs to A6
- HSSFHyperlink link2_shifted = sheet.getRow(3+2).getCell(0).getHyperlink();
- assertNotNull(link2_shifted);
- assertEquals(5, link2_shifted.getFirstRow());
+ assertNull(sheet.getRow(2).getCell(0).getHyperlink());\r
+ assertNull(sheet.getRow(3).getCell(0).getHyperlink());\r
+\r
+ //the first hyperlink now belongs to A5\r
+ HSSFHyperlink link1_shifted = sheet.getRow(2+2).getCell(0).getHyperlink();\r
+ assertNotNull(link1_shifted);\r
+ assertEquals(4, link1_shifted.getFirstRow());\r
+ assertEquals(4, link1_shifted.getLastRow());\r
+\r
+ //the second hyperlink now belongs to A6\r
+ HSSFHyperlink link2_shifted = sheet.getRow(3+2).getCell(0).getHyperlink();\r
+ assertNotNull(link2_shifted);\r
+ assertEquals(5, link2_shifted.getFirstRow());\r
assertEquals(5, link2_shifted.getLastRow());
}
}