Exemplo n.º 1
0
        private void ProcessExternalPart(PartInfo rel, OPCPackage outputPackage, DocumentProcessingActions action)
        {
            if (action == DocumentProcessingActions.Discover)
                return;

            outputPackage.AddContent(rel, null, m_openXmlFormat);
        }
Exemplo n.º 2
0
        private void ProcessPart(PartInfo rel, OPCPackage inputPackage, OPCPackage outputPackage, DocumentProcessingActions action)
        {
            if (rel.External)
            {
                ProcessExternalPart(rel, outputPackage, action);
                return;
            }

            if (m_ProcessedParts.ContainsKey(rel.AbsolutePath()))
            {
                if (outputPackage != null)
                    outputPackage.AddContent(rel, null, m_openXmlFormat);
                return;
            }

            m_ProcessedParts.Add(rel.AbsolutePath(), true);

            IPartFilter pf = GetPartFilter(rel, action);
            Stream inputData = rel.GetContent();
            RelatedPartProvider relPartProv = new RelatedPartProvider(inputPackage, rel);

            Stream modifiedStream = ProcessPartData(pf, inputData, relPartProv, action);

            if (modifiedStream != null)
                outputPackage.AddContent(rel, modifiedStream, m_openXmlFormat);

            if (action != DocumentProcessingActions.PassThrough && pf.IsBlockedFilter)
                return;

            foreach (PartInfo subRel in pf.SortRelatedParts(rel.GetRelatedObjects()))
            {
                ProcessPart(subRel, m_inputPackage, m_outputPackage, action);
            }
        }