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
|
@Override
|
||||||
@Deprecated
|
public int getNumberOfFonts() {
|
||||||
public short getNumberOfFonts() {
|
|
||||||
return (short) getNumberOfFontsAsInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getNumberOfFontsAsInt() {
|
|
||||||
return workbook.getNumberOfFontRecords();
|
return workbook.getNumberOfFontRecords();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public HSSFFont getFontAt(short idx) {
|
public int getNumberOfFontsAsInt() {
|
||||||
return getFontAt((int) idx);
|
return getNumberOfFonts();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -264,11 +264,9 @@ public interface Workbook extends Closeable, Iterable<Sheet> {
|
||||||
/**
|
/**
|
||||||
* Get the number of fonts in the font table
|
* Get the number of fonts in the font table
|
||||||
*
|
*
|
||||||
* @return number of fonts
|
* @return number of fonts (as int since POI 5.0.0)
|
||||||
* @deprecated use <code>getNumberOfFontsAsInt()</code> instead
|
|
||||||
*/
|
*/
|
||||||
@Removal(version = "4.2")
|
int getNumberOfFonts();
|
||||||
short getNumberOfFonts();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of fonts in the font table
|
* Get the number of fonts in the font table
|
||||||
|
@ -276,18 +274,10 @@ public interface Workbook extends Closeable, Iterable<Sheet> {
|
||||||
* @return number of fonts
|
* @return number of fonts
|
||||||
* @since 4.0.0
|
* @since 4.0.0
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
|
@Removal(version = "6.0.0")
|
||||||
int getNumberOfFontsAsInt();
|
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
|
* Get the font at the given index number
|
||||||
*
|
*
|
||||||
|
|
|
@ -852,22 +852,16 @@ public class SXSSFWorkbook implements Workbook {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
public int getNumberOfFonts() {
|
||||||
public short getNumberOfFonts() {
|
return _wb.getNumberOfFonts();
|
||||||
return (short)getNumberOfFontsAsInt();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
@Removal(version = "6.0.0")
|
||||||
public int getNumberOfFontsAsInt()
|
public int getNumberOfFontsAsInt()
|
||||||
{
|
{
|
||||||
return _wb.getNumberOfFontsAsInt();
|
return getNumberOfFonts();
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public Font getFontAt(short idx)
|
|
||||||
{
|
|
||||||
return getFontAt((int)idx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -977,11 +977,6 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su
|
||||||
return stylesSource.getStyleAt(idx);
|
return stylesSource.getStyleAt(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public XSSFFont getFontAt(short idx) {
|
|
||||||
return stylesSource.getFontAt(idx);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XSSFFont getFontAt(int idx) {
|
public XSSFFont getFontAt(int idx) {
|
||||||
return stylesSource.getFontAt(idx);
|
return stylesSource.getFontAt(idx);
|
||||||
|
@ -1076,13 +1071,15 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short getNumberOfFonts() {
|
public int getNumberOfFonts() {
|
||||||
return (short)getNumberOfFontsAsInt();
|
return stylesSource.getFonts().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
@Removal(version = "6.0.0")
|
||||||
public int getNumberOfFontsAsInt() {
|
public int getNumberOfFontsAsInt() {
|
||||||
return (short)stylesSource.getFonts().size();
|
return getNumberOfFonts();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -243,25 +243,6 @@ public final class TestHSSFName extends BaseTestNamedRange {
|
||||||
wb.close();
|
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
|
@Test
|
||||||
public final void testHSSFAddRemove() throws Exception {
|
public final void testHSSFAddRemove() throws Exception {
|
||||||
HSSFWorkbook wb = HSSFITestDataProvider.instance.createWorkbook();
|
HSSFWorkbook wb = HSSFITestDataProvider.instance.createWorkbook();
|
||||||
|
|
|
@ -28,6 +28,8 @@ import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
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.ITestDataProvider;
|
||||||
import org.apache.poi.ss.util.AreaReference;
|
import org.apache.poi.ss.util.AreaReference;
|
||||||
import org.apache.poi.ss.util.CellReference;
|
import org.apache.poi.ss.util.CellReference;
|
||||||
|
@ -116,6 +118,25 @@ public abstract class BaseTestNamedRange {
|
||||||
wb.close();
|
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
|
@Test
|
||||||
public final void testAddRemove() throws Exception {
|
public final void testAddRemove() throws Exception {
|
||||||
Workbook wb = _testDataProvider.createWorkbook();
|
Workbook wb = _testDataProvider.createWorkbook();
|
||||||
|
|
Loading…
Reference in New Issue