コード例 #1
0
        private static Record EncodeImages(IList<Image> images)
        {
            MSODRAWINGGROUP drawingGroup = new MSODRAWINGGROUP();
            MsofbtDggContainer dggContainer = new MsofbtDggContainer();
            drawingGroup.EscherRecords.Add(dggContainer);

            MsofbtDgg dgg = new MsofbtDgg();
            dgg.NumSavedDrawings = images.Count;
            dgg.NumSavedShapes = images.Count + 1;
            dgg.MaxShapeID = 1024 + dgg.NumSavedShapes;
            dgg.GroupIdClusters.Add(1, dgg.NumSavedShapes);
            dggContainer.EscherRecords.Add(dgg);

            MsofbtBstoreContainer bstoreContainer = new MsofbtBstoreContainer();
            bstoreContainer.Instance = (ushort)images.Count;
            foreach (Image image in images)
            {
                MsofbtBSE blipStoreEntry = new MsofbtBSE();
                blipStoreEntry.UID = Guid.NewGuid();
                blipStoreEntry.Ref = 1;
                blipStoreEntry.Version = 2;
                blipStoreEntry.BlipRecord = CreateBlipRecord(image);
                blipStoreEntry.BlipRecord.Type = image.Format;
                blipStoreEntry.BlipRecord.ImageData = image.Data;
                blipStoreEntry.BlipRecord.UID = blipStoreEntry.UID;
                blipStoreEntry.BlipRecord.Marker = 255;
                blipStoreEntry.SetBlipType(image.Format);
                bstoreContainer.EscherRecords.Add(blipStoreEntry);
            }
            dggContainer.EscherRecords.Add(bstoreContainer);

            MsofbtOPT defautProperties = new MsofbtOPT();
            defautProperties.Add(PropertyIDs.FitTextToShape, 524296);
            defautProperties.Add(PropertyIDs.FillColor, 134217793);
            defautProperties.Add(PropertyIDs.LineColor, 134217792);
            dggContainer.EscherRecords.Add(defautProperties);

            MsofbtSplitMenuColors splitMenuColors = new MsofbtSplitMenuColors();
            splitMenuColors.Instance = 4;
            splitMenuColors.Color1 = 134217741;
            splitMenuColors.Color2 = 134217740;
            splitMenuColors.Color3 = 134217751;
            splitMenuColors.Color4 = 268435703;
            dggContainer.EscherRecords.Add(splitMenuColors);

            return drawingGroup;
        }
コード例 #2
0
        public static EscherRecord Read(Stream stream)
        {
            EscherRecord escherRecord = EscherRecord.ReadBase(stream);
            ushort       type         = escherRecord.Type;
            EscherRecord result;

            switch (type)
            {
            case 61440:
                result = new MsofbtDggContainer(escherRecord);
                return(result);

            case 61441:
                result = new MsofbtBstoreContainer(escherRecord);
                return(result);

            case 61442:
                result = new MsofbtDgContainer(escherRecord);
                return(result);

            case 61443:
                result = new MsofbtSpgrContainer(escherRecord);
                return(result);

            case 61444:
                result = new MsofbtSpContainer(escherRecord);
                return(result);

            case 61445:
                result = new MsofbtSolverContainer(escherRecord);
                return(result);

            case 61446:
                result = new MsofbtDgg(escherRecord);
                return(result);

            case 61447:
                result = new MsofbtBSE(escherRecord);
                return(result);

            case 61448:
                result = new MsofbtDg(escherRecord);
                return(result);

            case 61449:
                result = new MsofbtSpgr(escherRecord);
                return(result);

            case 61450:
                result = new MsofbtSp(escherRecord);
                return(result);

            case 61451:
                result = new MsofbtOPT(escherRecord);
                return(result);

            case 61452:
                result = new MsofbtTextbox(escherRecord);
                return(result);

            case 61453:
                result = new MsofbtClientTextbox(escherRecord);
                return(result);

            case 61454:
                result = new MsofbtAnchor(escherRecord);
                return(result);

            case 61455:
                result = new MsofbtChildAnchor(escherRecord);
                return(result);

            case 61456:
                result = new MsofbtClientAnchor(escherRecord);
                return(result);

            case 61457:
                result = new MsofbtClientData(escherRecord);
                return(result);

            case 61458:
                result = new MsofbtConnectorRule(escherRecord);
                return(result);

            case 61459:
                result = new MsofbtAlignRule(escherRecord);
                return(result);

            case 61460:
                result = new MsofbtArcRule(escherRecord);
                return(result);

            case 61461:
                result = new MsofbtClientRule(escherRecord);
                return(result);

            case 61462:
                result = new MsofbtCLSID(escherRecord);
                return(result);

            case 61463:
                result = new MsofbtCalloutRule(escherRecord);
                return(result);

            case 61464:
                result = new MsofbtBlipStart(escherRecord);
                return(result);

            case 61465:
                break;

            case 61466:
                result = new MsofbtBlipMetafileEMF(escherRecord);
                return(result);

            case 61467:
                result = new MsofbtBlipMetafileWMF(escherRecord);
                return(result);

            case 61468:
                result = new MsofbtBlipMetafilePICT(escherRecord);
                return(result);

            case 61469:
                result = new MsofbtBlipBitmapJPEG(escherRecord);
                return(result);

            case 61470:
                result = new MsofbtBlipBitmapPNG(escherRecord);
                return(result);

            case 61471:
                result = new MsofbtBlipBitmapDIB(escherRecord);
                return(result);

            default:
                switch (type)
                {
                case 61719:
                    result = new MsofbtBlipEnd(escherRecord);
                    return(result);

                case 61720:
                    result = new MsofbtRegroupItems(escherRecord);
                    return(result);

                case 61721:
                    result = new MsofbtSelection(escherRecord);
                    return(result);

                case 61722:
                    result = new MsofbtColorMRU(escherRecord);
                    return(result);

                case 61725:
                    result = new MsofbtDeletedPspl(escherRecord);
                    return(result);

                case 61726:
                    result = new MsofbtSplitMenuColors(escherRecord);
                    return(result);

                case 61727:
                    result = new MsofbtOleObject(escherRecord);
                    return(result);

                case 61728:
                    result = new MsofbtColorScheme(escherRecord);
                    return(result);
                }
                break;
            }
            result = escherRecord;
            return(result);
        }