コード例 #1
0
 public TagPicture(int attribIndex, string mimeType, PICTURE_TYPE pictureType, string description, byte[] data)
 {
     this.Data           = null;
     this.AttributeIndex = -1;
     this.AttributeIndex = attribIndex;
     this.MIMEType       = mimeType;
     this.PictureType    = pictureType;
     this.Description    = description;
     this.Data           = data;
 }
コード例 #2
0
        public static void AddImage(byte[] data, PICTURE_TYPE type, int rowFrom, short columnFrom, int rowTo, short columnTo)
        {
            AndroidJavaObject anchor = new AndroidJavaObject("org.apache.poi.hssf.usermodel.HSSFClientAnchor", 0, 0, 0, 0, columnFrom, rowFrom, columnTo, rowTo);

            anchor.Call("setAnchorType", 2);

            int pictureIndex = workbook.Call <int>("addPicture", data, (int)type);

            patriarch.Call <AndroidJavaObject>("createPicture", anchor, pictureIndex);
        }
コード例 #3
0
        public TagPicture(Tag pTag)
        {
            this.Data           = null;
            this.AttributeIndex = -1;
            this.AttributeIndex = pTag.Index;
            this.MIMEType       = "Unknown";
            this.PictureType    = PICTURE_TYPE.Unknown;
            this.Description    = "";
            MemoryStream input  = null;
            BinaryReader reader = null;

            if (pTag.Name == "WM/Picture")
            {
                try
                {
                    input         = new MemoryStream((byte[])pTag);
                    reader        = new BinaryReader(input);
                    this.MIMEType = Marshal.PtrToStringUni(new IntPtr(reader.ReadInt32()));
                    byte num = reader.ReadByte();
                    try
                    {
                        this.PictureType = (PICTURE_TYPE)num;
                    }
                    catch
                    {
                        this.PictureType = PICTURE_TYPE.Unknown;
                    }
                    this.Description = Marshal.PtrToStringUni(new IntPtr(reader.ReadInt32()));
                    int length = reader.ReadInt32();
                    this.Data = new byte[length];
                    Marshal.Copy(new IntPtr(reader.ReadInt32()), this.Data, 0, length);
                }
                catch
                {
                }
                finally
                {
                    if (reader != null)
                    {
                        reader.Close();
                    }
                    if (input != null)
                    {
                        input.Close();
                    }
                }
            }
        }