From: Jason Height Date: Tue, 14 Oct 2003 23:18:03 +0000 (+0000) Subject: Dont forget to set the palette pos of the new palette record X-Git-Tag: PERF_BEFORE_MERGE~115 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cccbf615a5a63ec67824b87b02dae7e23d9f777e;p=poi.git Dont forget to set the palette pos of the new palette record git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353403 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/hssf/model/Workbook.java b/src/java/org/apache/poi/hssf/model/Workbook.java index e41867996b..2ef73c2f92 100644 --- a/src/java/org/apache/poi/hssf/model/Workbook.java +++ b/src/java/org/apache/poi/hssf/model/Workbook.java @@ -2086,6 +2086,7 @@ public class Workbook implements Model { palette = createPalette(); //Add the palette record after the bof which is always the first record records.add(1, palette); + records.setPalettepos(1); } return palette; } diff --git a/src/java/org/apache/poi/hssf/model/WorkbookRecordList.java b/src/java/org/apache/poi/hssf/model/WorkbookRecordList.java index 90eefaefa0..654ea88782 100644 --- a/src/java/org/apache/poi/hssf/model/WorkbookRecordList.java +++ b/src/java/org/apache/poi/hssf/model/WorkbookRecordList.java @@ -103,7 +103,7 @@ public class WorkbookRecordList if (getBackuppos() >= pos) setBackuppos( backuppos + 1 ); if (getNamepos() >= pos) setNamepos(namepos+1); if (getSupbookpos() >= pos) setSupbookpos(supbookpos+1); - if (getPalettepos() >= pos) setPalettepos( palettepos + 1 ); + if ((getPalettepos() != -1) && (getPalettepos() >= pos)) setPalettepos( palettepos + 1 ); if (getExternsheetPos() >= pos) setExternsheetPos(getExternsheetPos() + 1); } @@ -128,7 +128,7 @@ public class WorkbookRecordList if (getBackuppos() >= pos) setBackuppos( backuppos - 1 ); if (getNamepos() >= pos) setNamepos(getNamepos()-1); if (getSupbookpos() >= pos) setSupbookpos(getSupbookpos()-1); - if (getPalettepos() >= pos) setPalettepos( palettepos - 1 ); + if ((getPalettepos() != -1) && (getPalettepos() >= pos)) setPalettepos( palettepos - 1 ); if (getExternsheetPos() >= pos) setExternsheetPos( getExternsheetPos() -1); }