support for hyperlinks in SXSSF
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1145629 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
92381ae7d8
commit
5d0668da8d
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
<changes>
|
<changes>
|
||||||
<release version="3.8-beta4" date="2011-??-??">
|
<release version="3.8-beta4" date="2011-??-??">
|
||||||
|
<action dev="poi-developers" type="add">Support for hyperlinks in SXSSF</action>
|
||||||
<action dev="poi-developers" type="fix">49933 - Word 6/95 documents with sections cause ArrayIndexOutOfBoundsException</action>
|
<action dev="poi-developers" type="fix">49933 - Word 6/95 documents with sections cause ArrayIndexOutOfBoundsException</action>
|
||||||
<action dev="poi-developers" type="add">51469 - XSSF support for row styles, to match existing HSSF functionality</action>
|
<action dev="poi-developers" type="add">51469 - XSSF support for row styles, to match existing HSSF functionality</action>
|
||||||
<action dev="poi-developers" type="fix">51476 - Correct XSSF cell formatting in HTML export</action>
|
<action dev="poi-developers" type="fix">51476 - Correct XSSF cell formatting in HTML export</action>
|
||||||
|
@ -26,7 +26,8 @@ import org.apache.poi.ss.formula.eval.ErrorEval;
|
|||||||
import org.apache.poi.ss.usermodel.*;
|
import org.apache.poi.ss.usermodel.*;
|
||||||
import org.apache.poi.ss.formula.FormulaParseException;
|
import org.apache.poi.ss.formula.FormulaParseException;
|
||||||
import org.apache.poi.ss.util.CellRangeAddress;
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STCellType;
|
import org.apache.poi.ss.util.CellReference;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFHyperlink;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Streaming version of XSSFRow implementing the "BigGridDemo" strategy.
|
* Streaming version of XSSFRow implementing the "BigGridDemo" strategy.
|
||||||
@ -570,6 +571,15 @@ public class SXSSFCell implements Cell
|
|||||||
public void setHyperlink(Hyperlink link)
|
public void setHyperlink(Hyperlink link)
|
||||||
{
|
{
|
||||||
setProperty(Property.HYPERLINK,link);
|
setProperty(Property.HYPERLINK,link);
|
||||||
|
|
||||||
|
XSSFHyperlink xssfobj = (XSSFHyperlink)link;
|
||||||
|
// Assign to us
|
||||||
|
CellReference ref = new CellReference(getRowIndex(), getColumnIndex());
|
||||||
|
xssfobj.getCTHyperlink().setRef( ref.formatAsString() );
|
||||||
|
|
||||||
|
// Add to the lists
|
||||||
|
((SXSSFSheet)getSheet())._sh.addHyperlink(xssfobj);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -917,7 +917,7 @@ public final class XSSFCell implements Cell {
|
|||||||
link.setCellReference( new CellReference(_row.getRowNum(), _cellNum).formatAsString() );
|
link.setCellReference( new CellReference(_row.getRowNum(), _cellNum).formatAsString() );
|
||||||
|
|
||||||
// Add to the lists
|
// Add to the lists
|
||||||
getSheet().setCellHyperlink(link);
|
getSheet().addHyperlink(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,9 +88,9 @@ public class XSSFHyperlink implements Hyperlink {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the underlying hyperlink object
|
* @return the underlying CTHyperlink object
|
||||||
*/
|
*/
|
||||||
protected CTHyperlink getCTHyperlink() {
|
public CTHyperlink getCTHyperlink() {
|
||||||
return _ctHyperlink;
|
return _ctHyperlink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2501,7 +2501,13 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
|
|||||||
comment.setColumn(cellReference.getCol());
|
comment.setColumn(cellReference.getCol());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setCellHyperlink(XSSFHyperlink hyperlink) {
|
/**
|
||||||
|
* Register a hyperlink in the collection of hyperlinks on this sheet
|
||||||
|
*
|
||||||
|
* @param hyperlink the link to add
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void addHyperlink(XSSFHyperlink hyperlink) {
|
||||||
hyperlinks.add(hyperlink);
|
hyperlinks.add(hyperlink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
* (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.apache.poi.xssf.usermodel.streaming;
|
||||||
|
|
||||||
|
import org.apache.poi.ss.usermodel.BaseTestCell;
|
||||||
|
import org.apache.poi.ss.usermodel.BaseTestHyperlink;
|
||||||
|
import org.apache.poi.xssf.SXSSFITestDataProvider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test setting hyperlinks in SXSSF
|
||||||
|
*
|
||||||
|
* @author Yegor Kozlov
|
||||||
|
*/
|
||||||
|
public class TestSXSSFHyperlink extends BaseTestHyperlink {
|
||||||
|
|
||||||
|
public TestSXSSFHyperlink() {
|
||||||
|
super(SXSSFITestDataProvider.instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user