diff --git a/src/documentation/content/xdocs/changes.xml b/src/documentation/content/xdocs/changes.xml
index d8e6c421d7..825c99cc5b 100644
--- a/src/documentation/content/xdocs/changes.xml
+++ b/src/documentation/content/xdocs/changes.xml
@@ -37,6 +37,7 @@
+ 45175 - Support for variable length operands in org.apache.poi.hwpf.sprm.SprmOperation
Avoid spurious missing lines with the MissingRecordAware event code, and odd files that contain RowRecords in the middle of the cell Records.
Support for parsing formulas during EventUserModel processing, via the new EventWorkbookBuilder
diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml
index 93a290c0b0..cafa18cc54 100644
--- a/src/documentation/content/xdocs/status.xml
+++ b/src/documentation/content/xdocs/status.xml
@@ -34,6 +34,7 @@
+ 45175 - Support for variable length operands in org.apache.poi.hwpf.sprm.SprmOperation
Avoid spurious missing lines with the MissingRecordAware event code, and odd files that contain RowRecords in the middle of the cell Records.
Support for parsing formulas during EventUserModel processing, via the new EventWorkbookBuilder
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmOperation.java b/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmOperation.java
index cacbbaaa38..764fc06c4d 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmOperation.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmOperation.java
@@ -101,7 +101,14 @@ public class SprmOperation
case 3:
return LittleEndian.getInt(_grpprl, _gOffset);
case 6:
- throw new UnsupportedOperationException("This SPRM contains a variable length operand");
+ byte operandLength = _grpprl[_gOffset + 1]; //surely shorter than an int...
+
+ byte [] codeBytes = new byte[LittleEndian.INT_SIZE]; //initialized to zeros by JVM
+ for(int i = 0; i < operandLength; i++)
+ if(_gOffset + i < _grpprl.length)
+ codeBytes[i] = _grpprl[_gOffset + 1 + i];
+
+ return LittleEndian.getInt(codeBytes, 0);
case 7:
byte threeByteInt[] = new byte[4];
threeByteInt[0] = _grpprl[_gOffset];
diff --git a/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java b/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java
index bbad7b7f48..37e594940c 100644
--- a/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java
+++ b/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java
@@ -353,9 +353,6 @@ public final class TestMissingRecordAwareHSSFListener extends TestCase {
public void testNoExtraNewLines() throws Exception {
// Load a different file
openAlt();
- for(int i=0; i