Verify that bug 51998 is actually fixed since some time already.

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1705855 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2015-09-29 13:09:47 +00:00
parent 23164fc28f
commit 38827e7b29
2 changed files with 34 additions and 23 deletions

View File

@ -35,6 +35,7 @@ import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -61,29 +62,7 @@ import org.apache.poi.ss.formula.eval.ErrorEval;
import org.apache.poi.ss.formula.eval.NumberEval; import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.ValueEval; import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.Function; import org.apache.poi.ss.formula.functions.Function;
import org.apache.poi.ss.usermodel.BaseTestBugzillaIssues; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.CellValue;
import org.apache.poi.ss.usermodel.ClientAnchor;
import org.apache.poi.ss.usermodel.Comment;
import org.apache.poi.ss.usermodel.CreationHelper;
import org.apache.poi.ss.usermodel.DataFormat;
import org.apache.poi.ss.usermodel.DataFormatter;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.Drawing;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.FormulaError;
import org.apache.poi.ss.usermodel.FormulaEvaluator;
import org.apache.poi.ss.usermodel.Hyperlink;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Name;
import org.apache.poi.ss.usermodel.PrintSetup;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.SheetConditionalFormatting;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.ss.util.AreaReference; import org.apache.poi.ss.util.AreaReference;
import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.CellReference; import org.apache.poi.ss.util.CellReference;
@ -2812,4 +2791,36 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
wb.close(); wb.close();
} }
@Test
public void test51998() throws IOException {
Workbook wb = XSSFTestDataSamples.openSampleWorkbook("51998.xlsx");
Set<String> sheetNames = new HashSet<String>();
for (int sheetNum = 0; sheetNum < wb.getNumberOfSheets(); sheetNum++)
{
sheetNames.add(wb.getSheetName(sheetNum));
}
for (String sheetName : sheetNames)
{
int sheetIndex = wb.getSheetIndex(sheetName);
wb.removeSheetAt(sheetIndex);
Sheet newSheet = wb.createSheet();
//Sheet newSheet = wb.createSheet(sheetName);
int newSheetIndex = wb.getSheetIndex(newSheet);
//System.out.println(newSheetIndex);
wb.setSheetName(newSheetIndex, sheetName);
wb.setSheetOrder(sheetName, sheetIndex);
}
Workbook wbBack = XSSFTestDataSamples.writeOutAndReadBack(wb);
wb.close();
assertNotNull(wbBack);
wbBack.close();
}
} }

Binary file not shown.