public String toString() {
   StringBuffer sb = new StringBuffer();
   sb.append("[ftPictFmla]\n");
   sb.append("    .f2unknown     = ").append(HexDump.intToHex(field_1_unknown_int)).append("\n");
   if (field_2_refPtg == null) {
     sb.append("    .f3unknown     = ")
         .append(HexDump.toHex(field_2_unknownFormulaData))
         .append("\n");
   } else {
     sb.append("    .formula       = ").append(field_2_refPtg.toString()).append("\n");
   }
   if (field_4_ole_classname != null) {
     sb.append("    .unicodeFlag   = ").append(field_3_unicode_flag).append("\n");
     sb.append("    .oleClassname  = ").append(field_4_ole_classname).append("\n");
   }
   if (field_4_unknownByte != null) {
     sb.append("    .f4unknown   = ")
         .append(HexDump.byteToHex(field_4_unknownByte.intValue()))
         .append("\n");
   }
   if (field_5_stream_id != null) {
     sb.append("    .streamId      = ")
         .append(HexDump.intToHex(field_5_stream_id.intValue()))
         .append("\n");
   }
   if (field_6_unknown.length > 0) {
     sb.append("    .f7unknown     = ").append(HexDump.toHex(field_6_unknown)).append("\n");
   }
   sb.append("[/ftPictFmla]");
   return sb.toString();
 }
示例#2
0
 public String toString() {
   StringBuffer sb = new StringBuffer();
   sb.append("[LABEL]\n");
   sb.append("    .row       = ").append(HexDump.shortToHex(getRow())).append("\n");
   sb.append("    .column    = ").append(HexDump.shortToHex(getColumn())).append("\n");
   sb.append("    .xfindex   = ").append(HexDump.shortToHex(getXFIndex())).append("\n");
   sb.append("    .string_len= ").append(HexDump.shortToHex(field_4_string_len)).append("\n");
   sb.append("    .unicode_flag= ").append(HexDump.byteToHex(field_5_unicode_flag)).append("\n");
   sb.append("    .value       = ").append(getValue()).append("\n");
   sb.append("[/LABEL]\n");
   return sb.toString();
 }
  @Override
  public String toString() {
    StringBuffer buffer = new StringBuffer();
    buffer.append("[SXVD]\n");
    buffer.append("    .sxaxis    = ").append(HexDump.shortToHex(_sxaxis)).append('\n');
    buffer.append("    .cSub      = ").append(HexDump.shortToHex(_cSub)).append('\n');
    buffer.append("    .grbitSub  = ").append(HexDump.shortToHex(_grbitSub)).append('\n');
    buffer.append("    .cItm      = ").append(HexDump.shortToHex(_cItm)).append('\n');
    buffer.append("    .name      = ").append(_name).append('\n');

    buffer.append("[/SXVD]\n");
    return buffer.toString();
  }
 public String toString() {
   String extraData = HexDump.toHex(field_pictureData, 32);
   return getClass().getName()
       + ":"
       + '\n'
       + "  RecordId: 0x"
       + HexDump.toHex(getRecordId())
       + '\n'
       + "  Options: 0x"
       + HexDump.toHex(getOptions())
       + '\n'
       + "  Extra Data:"
       + '\n'
       + extraData;
 }
示例#5
0
  /** @param in the RecordInputstream to read the record from */
  public LabelRecord(RecordInputStream in) {
    field_1_row = in.readUShort();
    field_2_column = in.readShort();
    field_3_xf_index = in.readShort();
    field_4_string_len = in.readShort();
    field_5_unicode_flag = in.readByte();
    if (field_4_string_len > 0) {
      if (isUnCompressedUnicode()) {
        field_6_value = in.readUnicodeLEString(field_4_string_len);
      } else {
        field_6_value = in.readCompressedUnicode(field_4_string_len);
      }
    } else {
      field_6_value = "";
    }

    if (in.remaining() > 0) {
      logger.log(
          POILogger.INFO,
          "LabelRecord data remains: "
              + in.remaining()
              + " : "
              + HexDump.toHex(in.readRemainder()));
    }
  }
    public String formatAsString() {

      StringBuilder sb = new StringBuilder(36);

      int PREFIX_LEN = "0x".length();
      sb.append(HexDump.intToHex(_d1), PREFIX_LEN, 8);
      sb.append("-");
      sb.append(HexDump.shortToHex(_d2), PREFIX_LEN, 4);
      sb.append("-");
      sb.append(HexDump.shortToHex(_d3), PREFIX_LEN, 4);
      sb.append("-");
      char[] d4Chars = HexDump.longToHex(getD4());
      sb.append(d4Chars, PREFIX_LEN, 4);
      sb.append("-");
      sb.append(d4Chars, PREFIX_LEN + 4, 12);
      return sb.toString();
    }
  public String toString() {
    StringBuffer sb = new StringBuffer();

    sb.append("[TXO]\n");
    sb.append("    .options        = ").append(HexDump.shortToHex(field_1_options)).append("\n");
    sb.append("         .isHorizontal = ").append(getHorizontalTextAlignment()).append('\n');
    sb.append("         .isVertical   = ").append(getVerticalTextAlignment()).append('\n');
    sb.append("         .textLocked   = ").append(isTextLocked()).append('\n');
    sb.append("    .textOrientation= ")
        .append(HexDump.shortToHex(getTextOrientation()))
        .append("\n");
    sb.append("    .reserved4      = ").append(HexDump.shortToHex(field_3_reserved4)).append("\n");
    sb.append("    .reserved5      = ").append(HexDump.shortToHex(field_4_reserved5)).append("\n");
    sb.append("    .reserved6      = ").append(HexDump.shortToHex(field_5_reserved6)).append("\n");
    sb.append("    .textLength     = ").append(HexDump.shortToHex(_text.length())).append("\n");
    sb.append("    .reserved7      = ").append(HexDump.intToHex(field_8_reserved7)).append("\n");

    sb.append("    .string = ").append(_text).append('\n');

    for (int i = 0; i < _text.numFormattingRuns(); i++) {
      sb.append("    .textrun = ").append(_text.getFontOfFormattingRun(i)).append('\n');
    }
    sb.append("[/TXO]\n");
    return sb.toString();
  }
 public String toString() {
   String extraData = HexDump.toHex(field_pictureData, 32);
   return getClass().getName()
       + ":"
       + '\n'
       + "  RecordId: 0x"
       + HexDump.toHex(getRecordId())
       + '\n'
       + "  Version: 0x"
       + HexDump.toHex(getVersion())
       + '\n'
       + "  Instance: 0x"
       + HexDump.toHex(getInstance())
       + '\n'
       + "  Extra Data:"
       + '\n'
       + extraData;
 }
  public String toString() {
    StringBuffer buffer = new StringBuffer();

    String nl = System.getProperty("line.separator");
    buffer.append("[ftGmo]" + nl);
    buffer.append("  reserved = ").append(HexDump.toHex(reserved)).append(nl);
    buffer.append("[/ftGmo]" + nl);
    return buffer.toString();
  }
 @Override
 public String toXml(String tab) {
   String extraData = HexDump.toHex(field_pictureData, 32);
   StringBuilder builder = new StringBuilder();
   builder
       .append(tab)
       .append(
           formatXmlRecordHeader(
               getClass().getSimpleName(),
               HexDump.toHex(getRecordId()),
               HexDump.toHex(getVersion()),
               HexDump.toHex(getInstance())))
       .append(tab)
       .append("\t")
       .append("<ExtraData>")
       .append(extraData)
       .append("</ExtraData>\n");
   builder.append(tab).append("</").append(getClass().getSimpleName()).append(">\n");
   return builder.toString();
 }
示例#11
0
  public String toString() {

    StringBuffer field_5_string = new StringBuffer();
    if (field_5_fileIdClusters != null)
      for (int i = 0; i < field_5_fileIdClusters.length; i++) {
        field_5_string.append("  DrawingGroupId").append(i + 1).append(": ");
        field_5_string.append(field_5_fileIdClusters[i].field_1_drawingGroupId);
        field_5_string.append('\n');
        field_5_string.append("  NumShapeIdsUsed").append(i + 1).append(": ");
        field_5_string.append(field_5_fileIdClusters[i].field_2_numShapeIdsUsed);
        field_5_string.append('\n');
      }
    return getClass().getName()
        + ":"
        + '\n'
        + "  RecordId: 0x"
        + HexDump.toHex(RECORD_ID)
        + '\n'
        + "  Version: 0x"
        + HexDump.toHex(getVersion())
        + '\n'
        + "  Instance: 0x"
        + HexDump.toHex(getInstance())
        + '\n'
        + "  ShapeIdMax: "
        + field_1_shapeIdMax
        + '\n'
        + "  NumIdClusters: "
        + getNumIdClusters()
        + '\n'
        + "  NumShapesSaved: "
        + field_3_numShapesSaved
        + '\n'
        + "  DrawingsSaved: "
        + field_4_drawingsSaved
        + '\n'
        + ""
        + field_5_string.toString();
  }
示例#12
0
 /** @return the string representation of this record. */
 public String toString() {
   return getClass().getName()
       + ":"
       + '\n'
       + "  RecordId: 0x"
       + HexDump.toHex(RECORD_ID)
       + '\n'
       + "  Options: 0x"
       + HexDump.toHex(getOptions())
       + '\n'
       + "  RectX: "
       + field_1_rectX1
       + '\n'
       + "  RectY: "
       + field_2_rectY1
       + '\n'
       + "  RectWidth: "
       + field_3_rectX2
       + '\n'
       + "  RectHeight: "
       + field_4_rectY2
       + '\n';
 }
示例#13
0
  public String toString() {
    StringBuffer buffer = new StringBuffer();

    buffer.append("[SERIES]\n");
    buffer
        .append("    .categoryDataType     = ")
        .append("0x")
        .append(HexDump.toHex(getCategoryDataType()))
        .append(" (")
        .append(getCategoryDataType())
        .append(" )");
    buffer.append(System.getProperty("line.separator"));
    buffer
        .append("    .valuesDataType       = ")
        .append("0x")
        .append(HexDump.toHex(getValuesDataType()))
        .append(" (")
        .append(getValuesDataType())
        .append(" )");
    buffer.append(System.getProperty("line.separator"));
    buffer
        .append("    .numCategories        = ")
        .append("0x")
        .append(HexDump.toHex(getNumCategories()))
        .append(" (")
        .append(getNumCategories())
        .append(" )");
    buffer.append(System.getProperty("line.separator"));
    buffer
        .append("    .numValues            = ")
        .append("0x")
        .append(HexDump.toHex(getNumValues()))
        .append(" (")
        .append(getNumValues())
        .append(" )");
    buffer.append(System.getProperty("line.separator"));
    buffer
        .append("    .bubbleSeriesType     = ")
        .append("0x")
        .append(HexDump.toHex(getBubbleSeriesType()))
        .append(" (")
        .append(getBubbleSeriesType())
        .append(" )");
    buffer.append(System.getProperty("line.separator"));
    buffer
        .append("    .numBubbleValues      = ")
        .append("0x")
        .append(HexDump.toHex(getNumBubbleValues()))
        .append(" (")
        .append(getNumBubbleValues())
        .append(" )");
    buffer.append(System.getProperty("line.separator"));

    buffer.append("[/SERIES]\n");
    return buffer.toString();
  }
示例#14
0
  @Override
  protected void appendValueText(StringBuilder sb) {
    sb.append("  .value	 = ");
    if (specialCachedValue == null) {
      sb.append(field_4_value).append("\n");
    } else {
      sb.append(specialCachedValue.formatDebugString()).append("\n");
    }
    sb.append("  .options   = ").append(HexDump.shortToHex(getOptions())).append("\n");
    sb.append("    .alwaysCalc= ").append(isAlwaysCalc()).append("\n");
    sb.append("    .calcOnLoad= ").append(isCalcOnLoad()).append("\n");
    sb.append("    .shared    = ").append(isSharedFormula()).append("\n");
    sb.append("  .zero      = ").append(HexDump.intToHex(field_6_zero)).append("\n");

    Ptg[] ptgs = field_8_parsed_expr.getTokens();
    for (int k = 0; k < ptgs.length; k++) {
      if (k > 0) {
        sb.append("\n");
      }
      sb.append("    Ptg[").append(k).append("]=");
      Ptg ptg = ptgs[k];
      sb.append(ptg.toString()).append(ptg.getRVAType());
    }
  }
示例#15
0
  /* assert shape properties when reading shapes from a existing workbook */
  public void testReadExistingRectangle() {
    HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("drawings.xls");
    HSSFSheet sheet = wb.getSheet("rectangles");
    HSSFPatriarch drawing = sheet.getDrawingPatriarch();
    assertEquals(1, drawing.getChildren().size());

    HSSFSimpleShape shape = (HSSFSimpleShape) drawing.getChildren().get(0);
    assertEquals(shape.isNoFill(), false);
    assertEquals(shape.getLineStyle(), HSSFShape.LINESTYLE_DASHDOTGEL);
    assertEquals(shape.getLineStyleColor(), 0x616161);
    assertEquals(HexDump.toHex(shape.getFillColor()), shape.getFillColor(), 0x2CE03D);
    assertEquals(shape.getLineWidth(), HSSFShape.LINEWIDTH_ONE_PT * 2);
    assertEquals(shape.getString().getString(), "POItest");
    assertEquals(shape.getRotationDegree(), 27);
  }
  /** Returns the string representation of this record. */
  public String toString() {
    String nl = System.getProperty("line.separator");

    String extraData;
    ByteArrayOutputStream b = new ByteArrayOutputStream();
    try {
      HexDump.dump(this.remainingData, 0, b, 0);
      extraData = b.toString();
    } catch (Exception e) {
      extraData = "error\n";
    }
    return getClass().getName()
        + ":"
        + nl
        + "  RecordId: 0x"
        + HexDump.toHex(RECORD_ID)
        + nl
        + "  Options: 0x"
        + HexDump.toHex(getOptions())
        + nl
        + "  Extra Data:"
        + nl
        + extraData;
  }
示例#17
0
 /**
  * Silently swallow unexpected contents in InterfaceEndRecord. Although it violates the spec,
  * Excel silently converts this data to an {@link InterfaceHdrRecord}.
  */
 public void testUnexpectedBytes_bug47251() {
   String hex =
       ""
           + "09 08 10 00 00 06 05 00 EC 15 CD 07 C1 C0 00 00 06 03 00 00 "
           + // BOF
           "E2 00 02 00 B0 04 "
           + // INTERFACEEND with extra two bytes
           "0A 00 00 00"; // EOF
   byte[] data = HexRead.readFromString(hex);
   List<Record> records = RecordFactory.createRecords(new ByteArrayInputStream(data));
   assertEquals(3, records.size());
   Record rec1 = records.get(1);
   assertEquals(InterfaceHdrRecord.class, rec1.getClass());
   InterfaceHdrRecord r = (InterfaceHdrRecord) rec1;
   assertEquals("[E1, 00, 02, 00, B0, 04]", HexDump.toHex(r.serialize()));
 }
示例#18
0
  public String toString() {
    StringBuffer buffer = new StringBuffer();

    buffer.append("[HYPERLINK RECORD]\n");
    buffer.append("    .range   = ").append(_range.formatAsString()).append("\n");
    buffer.append("    .guid    = ").append(_guid.formatAsString()).append("\n");
    buffer.append("    .linkOpts= ").append(HexDump.intToHex(_linkOpts)).append("\n");
    buffer.append("    .label   = ").append(getLabel()).append("\n");
    if ((_linkOpts & HLINK_TARGET_FRAME) != 0) {
      buffer.append("    .targetFrame= ").append(getTargetFrame()).append("\n");
    }
    if ((_linkOpts & HLINK_URL) != 0 && _moniker != null) {
      buffer.append("    .moniker   = ").append(_moniker.formatAsString()).append("\n");
    }
    if ((_linkOpts & HLINK_PLACE) != 0) {
      buffer.append("    .textMark= ").append(getTextMark()).append("\n");
    }
    buffer.append("    .address   = ").append(getAddress()).append("\n");
    buffer.append("[/HYPERLINK RECORD]\n");
    return buffer.toString();
  }
示例#19
0
 /**
  * @param tab - each children must be a right of his parent
  * @return xml representation of this record
  */
 public String toXml(String tab) {
   StringBuilder builder = new StringBuilder();
   builder
       .append(tab)
       .append("<")
       .append(getClass().getSimpleName())
       .append(">\n")
       .append(tab)
       .append("\t")
       .append("<RecordId>0x")
       .append(HexDump.toHex(_recordId))
       .append("</RecordId>\n")
       .append(tab)
       .append("\t")
       .append("<Options>")
       .append(_options)
       .append("</Options>\n")
       .append(tab)
       .append("</")
       .append(getClass().getSimpleName())
       .append(">\n");
   return builder.toString();
 }
示例#20
0
  /**
   * Get an array of objects, some of which may implement POIFSViewable
   *
   * @return an array of Object; may not be null, but may be empty
   */
  public Object[] getViewableArray() {
    String result = "<NO DATA>";

    try {
      BlockWritable[] blocks = null;

      if (_big_store.isValid()) {
        blocks = _big_store.getBlocks();
      } else if (_small_store.isValid()) {
        blocks = _small_store.getBlocks();
      }
      if (blocks != null) {
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        for (BlockWritable bw : blocks) {
          bw.writeBlocks(output);
        }
        int length = Math.min(output.size(), _property.getSize());
        result = HexDump.dump(output.toByteArray(), 0, 0, length);
      }
    } catch (IOException e) {
      result = e.getMessage();
    }
    return new String[] {result};
  }
示例#21
0
 private static String formatDoubleAsHex(double d) {
   long l = Double.doubleToLongBits(d);
   StringBuilder sb = new StringBuilder(20);
   sb.append(HexDump.longToHex(l)).append('L');
   return sb.toString();
 }
示例#22
0
 public String formatDebugString() {
   return formatValue() + ' ' + HexDump.toHex(_variableData);
 }
示例#23
0
  public HyperlinkRecord(RecordInputStream in) {
    _range = new CellRangeAddress(in);

    _guid = new GUID(in);

    /**
     * streamVersion (4 bytes): An unsigned integer that specifies the version number of the
     * serialization implementation used to save this structure. This value MUST equal 2.
     */
    int streamVersion = in.readInt();
    if (streamVersion != 0x00000002) {
      throw new RecordFormatException("Stream Version must be 0x2 but found " + streamVersion);
    }
    _linkOpts = in.readInt();

    if ((_linkOpts & HLINK_LABEL) != 0) {
      int label_len = in.readInt();
      _label = in.readUnicodeLEString(label_len);
    }

    if ((_linkOpts & HLINK_TARGET_FRAME) != 0) {
      int len = in.readInt();
      _targetFrame = in.readUnicodeLEString(len);
    }

    if ((_linkOpts & HLINK_URL) != 0 && (_linkOpts & HLINK_UNC_PATH) != 0) {
      _moniker = null;
      int nChars = in.readInt();
      _address = in.readUnicodeLEString(nChars);
    }

    if ((_linkOpts & HLINK_URL) != 0 && (_linkOpts & HLINK_UNC_PATH) == 0) {
      _moniker = new GUID(in);

      if (URL_MONIKER.equals(_moniker)) {
        int length = in.readInt();
        /**
         * The value of <code>length<code> be either the byte size of the url field
         * (including the terminating NULL character) or the byte size of the url field plus 24.
         * If the value of this field is set to the byte size of the url field,
         * then the tail bytes fields are not present.
         */
        int remaining = in.remaining();
        if (length == remaining) {
          int nChars = length / 2;
          _address = in.readUnicodeLEString(nChars);
        } else {
          int nChars = (length - TAIL_SIZE) / 2;
          _address = in.readUnicodeLEString(nChars);
          /**
           * TODO: make sense of the remaining bytes According to the spec they consist of: 1.
           * 16-byte GUID: This field MUST equal {0xF4815879, 0x1D3B, 0x487F, 0xAF, 0x2C, 0x82,
           * 0x5D, 0xC4, 0x85, 0x27, 0x63} 2. Serial version, this field MUST equal 0 if present. 3.
           * URI Flags
           */
          _uninterpretedTail = readTail(URL_TAIL, in);
        }
      } else if (FILE_MONIKER.equals(_moniker)) {
        _fileOpts = in.readShort();

        int len = in.readInt();
        _shortFilename = StringUtil.readCompressedUnicode(in, len);
        _uninterpretedTail = readTail(FILE_TAIL, in);
        int size = in.readInt();
        if (size > 0) {
          int charDataSize = in.readInt();

          // From the spec: An optional unsigned integer that MUST be 3 if present
          // but some files has 4
          int usKeyValue = in.readUShort();

          _address = StringUtil.readUnicodeLE(in, charDataSize / 2);
        } else {
          _address = null;
        }
      } else if (STD_MONIKER.equals(_moniker)) {
        _fileOpts = in.readShort();

        int len = in.readInt();

        byte[] path_bytes = new byte[len];
        in.readFully(path_bytes);

        _address = new String(path_bytes);
      }
    }

    if ((_linkOpts & HLINK_PLACE) != 0) {

      int len = in.readInt();
      _textMark = in.readUnicodeLEString(len);
    }

    if (in.remaining() > 0) {
      logger.log(
          POILogger.WARN,
          "Hyperlink data remains: " + in.remaining() + " : " + HexDump.toHex(in.readRemainder()));
    }
  }