mirror of https://github.com/apache/poi.git
remove some deprecated Font methods from Workbook
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1879259 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
33261cd4d2
commit
b12e13a041
|
@ -1196,20 +1196,14 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
|
|||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public short getNumberOfFonts() {
|
||||
return (short) getNumberOfFontsAsInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumberOfFontsAsInt() {
|
||||
public int getNumberOfFonts() {
|
||||
return workbook.getNumberOfFontRecords();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public HSSFFont getFontAt(short idx) {
|
||||
return getFontAt((int) idx);
|
||||
public int getNumberOfFontsAsInt() {
|
||||
return getNumberOfFonts();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -264,11 +264,9 @@ public interface Workbook extends Closeable, Iterable<Sheet> {
|
|||
/**
|
||||
* Get the number of fonts in the font table
|
||||
*
|
||||
* @return number of fonts
|
||||
* @deprecated use <code>getNumberOfFontsAsInt()</code> instead
|
||||
* @return number of fonts (as int since POI 5.0.0)
|
||||
*/
|
||||
@Removal(version = "4.2")
|
||||
short getNumberOfFonts();
|
||||
int getNumberOfFonts();
|
||||
|
||||
/**
|
||||
* Get the number of fonts in the font table
|
||||
|
@ -276,18 +274,10 @@ public interface Workbook extends Closeable, Iterable<Sheet> {
|
|||
* @return number of fonts
|
||||
* @since 4.0.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Removal(version = "6.0.0")
|
||||
int getNumberOfFontsAsInt();
|
||||
|
||||
/**
|
||||
* Get the font at the given index number
|
||||
*
|
||||
* @param idx index number (0-based)
|
||||
* @return font at the index
|
||||
* @deprecated use <code>getFontAt(int)</code>
|
||||
*/
|
||||
@Removal(version = "4.2")
|
||||
Font getFontAt(short idx);
|
||||
|
||||
/**
|
||||
* Get the font at the given index number
|
||||
*
|
||||
|
|
|
@ -852,22 +852,16 @@ public class SXSSFWorkbook implements Workbook {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public short getNumberOfFonts() {
|
||||
return (short)getNumberOfFontsAsInt();
|
||||
public int getNumberOfFonts() {
|
||||
return _wb.getNumberOfFonts();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
@Removal(version = "6.0.0")
|
||||
public int getNumberOfFontsAsInt()
|
||||
{
|
||||
return _wb.getNumberOfFontsAsInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public Font getFontAt(short idx)
|
||||
{
|
||||
return getFontAt((int)idx);
|
||||
return getNumberOfFonts();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -977,11 +977,6 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su
|
|||
return stylesSource.getStyleAt(idx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XSSFFont getFontAt(short idx) {
|
||||
return stylesSource.getFontAt(idx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XSSFFont getFontAt(int idx) {
|
||||
return stylesSource.getFontAt(idx);
|
||||
|
@ -1076,13 +1071,15 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su
|
|||
}
|
||||
|
||||
@Override
|
||||
public short getNumberOfFonts() {
|
||||
return (short)getNumberOfFontsAsInt();
|
||||
public int getNumberOfFonts() {
|
||||
return stylesSource.getFonts().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
@Removal(version = "6.0.0")
|
||||
public int getNumberOfFontsAsInt() {
|
||||
return (short)stylesSource.getFonts().size();
|
||||
return getNumberOfFonts();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -243,25 +243,6 @@ public final class TestHSSFName extends BaseTestNamedRange {
|
|||
wb.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public final void testUnicodeNamedRange() throws Exception {
|
||||
HSSFWorkbook wb1 = new HSSFWorkbook();
|
||||
wb1.createSheet("Test");
|
||||
Name name = wb1.createName();
|
||||
name.setNameName("\u03B1");
|
||||
name.setRefersToFormula("Test!$D$3:$E$8");
|
||||
|
||||
|
||||
HSSFWorkbook wb2 = HSSFITestDataProvider.instance.writeOutAndReadBack(wb1);
|
||||
Name name2 = wb2.getNameAt(0);
|
||||
|
||||
assertEquals("\u03B1", name2.getNameName());
|
||||
assertEquals("Test!$D$3:$E$8", name2.getRefersToFormula());
|
||||
|
||||
wb2.close();
|
||||
wb1.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public final void testHSSFAddRemove() throws Exception {
|
||||
HSSFWorkbook wb = HSSFITestDataProvider.instance.createWorkbook();
|
||||
|
|
|
@ -28,6 +28,8 @@ import java.io.IOException;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.poi.hssf.HSSFITestDataProvider;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.ITestDataProvider;
|
||||
import org.apache.poi.ss.util.AreaReference;
|
||||
import org.apache.poi.ss.util.CellReference;
|
||||
|
@ -116,6 +118,25 @@ public abstract class BaseTestNamedRange {
|
|||
wb.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public final void testUnicodeNamedRange() throws Exception {
|
||||
HSSFWorkbook wb1 = new HSSFWorkbook();
|
||||
wb1.createSheet("Test");
|
||||
Name name = wb1.createName();
|
||||
name.setNameName("\u03B1");
|
||||
name.setRefersToFormula("Test!$D$3:$E$8");
|
||||
|
||||
|
||||
HSSFWorkbook wb2 = HSSFITestDataProvider.instance.writeOutAndReadBack(wb1);
|
||||
Name name2 = wb2.getName("\u03B1");
|
||||
|
||||
assertEquals("\u03B1", name2.getNameName());
|
||||
assertEquals("Test!$D$3:$E$8", name2.getRefersToFormula());
|
||||
|
||||
wb2.close();
|
||||
wb1.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public final void testAddRemove() throws Exception {
|
||||
Workbook wb = _testDataProvider.createWorkbook();
|
||||
|
|
Loading…
Reference in New Issue