当前位置: 首页>>代码示例>>C#>>正文


C# PackagePart.GetInputStream方法代码示例

本文整理汇总了C#中NPOI.OpenXml4Net.OPC.PackagePart.GetInputStream方法的典型用法代码示例。如果您正苦于以下问题:C# PackagePart.GetInputStream方法的具体用法?C# PackagePart.GetInputStream怎么用?C# PackagePart.GetInputStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NPOI.OpenXml4Net.OPC.PackagePart的用法示例。


在下文中一共展示了PackagePart.GetInputStream方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CommentsTable

        internal CommentsTable(PackagePart part, PackageRelationship rel)
            : base(part, rel)
        {

            XmlDocument xml = ConvertStreamToXml(part.GetInputStream());
            ReadFrom(xml);
        }
开发者ID:89sos98,项目名称:npoi,代码行数:7,代码来源:CommentsTable.cs

示例2: XSSFChart

        /**
         * Construct a SpreadsheetML chart from a namespace part.
         *
         * @param part the namespace part holding the chart data,
         * the content type must be <code>application/vnd.Openxmlformats-officedocument.Drawingml.chart+xml</code>
         * @param rel  the namespace relationship holding this chart,
         * the relationship type must be http://schemas.Openxmlformats.org/officeDocument/2006/relationships/chart
         */
        protected XSSFChart(PackagePart part, PackageRelationship rel)
            : base(part, rel)
        {


            chartSpace = ChartSpaceDocument.Parse(part.GetInputStream()).GetChartSpace();
            chart = chartSpace.chart;
        }
开发者ID:WPG,项目名称:npoi,代码行数:16,代码来源:XSSFChart.cs

示例3: XSSFChart

        /**
         * Construct a SpreadsheetML chart from a namespace part.
         *
         * @param part the namespace part holding the chart data,
         * the content type must be <code>application/vnd.Openxmlformats-officedocument.Drawingml.chart+xml</code>
         * @param rel  the namespace relationship holding this chart,
         * the relationship type must be http://schemas.Openxmlformats.org/officeDocument/2006/relationships/chart
         */
        protected XSSFChart(PackagePart part, PackageRelationship rel)
            : base(part, rel)
        {

            XmlDocument doc = ConvertStreamToXml(part.GetInputStream());
            chartSpaceDocument = ChartSpaceDocument.Parse(doc, NamespaceManager);
            chart = chartSpaceDocument.GetChartSpace().chart;
        }
开发者ID:eatage,项目名称:npoi,代码行数:16,代码来源:XSSFChart.cs

示例4: XSSFDrawing

 /**
  * Construct a SpreadsheetML Drawing from a namespace part
  *
  * @param part the namespace part holding the Drawing data,
  * the content type must be <code>application/vnd.openxmlformats-officedocument.Drawing+xml</code>
  * @param rel  the namespace relationship holding this Drawing,
  * the relationship type must be http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing
  */
 internal XSSFDrawing(PackagePart part, PackageRelationship rel)
     : base(part, rel)
 {
     //XmlOptions options = new XmlOptions(DEFAULT_XML_OPTIONS);
     ////Removing root element
     //options.setLoadReplaceDocumentElement(null);
     //drawing = CTDrawing.Factory.parse(part.getInputStream(), options);
     drawing = NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_Drawing.Parse(part.GetInputStream());
 }
开发者ID:kenlen,项目名称:npoi,代码行数:17,代码来源:XSSFDrawing.cs

示例5: Marshall

        /**
         * Save the specified part.
         *
         * @throws OpenXml4NetException
         *             Throws if an internal exception is thrown.
         */
        public bool Marshall(PackagePart part, Stream os)
        {
            if (!(os is ZipOutputStream))
            {
                logger.Log(POILogger.ERROR,"Unexpected class " + os.GetType().Name);
                throw new OpenXml4NetException("ZipOutputStream expected !");
                // Normally should happen only in developement phase, so just throw
                // exception
            }

            ZipOutputStream zos = (ZipOutputStream)os;
            string name = ZipHelper
                    .GetZipItemNameFromOPCName(part.PartName.URI
                            .OriginalString);
            ZipEntry partEntry = new ZipEntry(name);
            try
            {
                // Create next zip entry
                zos.PutNextEntry(partEntry);

                // Saving data in the ZIP file
                Stream ins = part.GetInputStream();
                byte[] buff = new byte[ZipHelper.READ_WRITE_FILE_BUFFER_SIZE];
                int totalRead = 0;
                while (true)
                {
                    int resultRead = ins.Read(buff, 0, buff.Length);
                    if (resultRead == 0)
                    {
                        // End of file reached
                        break;
                    }
                    zos.Write(buff, 0, resultRead);
                    totalRead += resultRead;
                }
                zos.CloseEntry();
            }
            catch (IOException ioe)
            {
                logger.Log(POILogger.ERROR, "Cannot write: " + part.PartName + ": in ZIP", ioe);
                return false;
            }

            // Saving relationship part
            if (part.HasRelationships)
            {
                PackagePartName relationshipPartName = PackagingUriHelper
                        .GetRelationshipPartName(part.PartName);

                MarshallRelationshipPart(part.Relationships,
                        relationshipPartName, zos);

            }
            return true;
        }
开发者ID:ctddjyds,项目名称:npoi,代码行数:61,代码来源:ZipPartMarshaller.cs

示例6: ThemesTable

        internal ThemesTable(PackagePart part, PackageRelationship rel)
            : base(part, rel)
        {

            //theme = ThemeDocument.Parse(part.GetInputStream());
            try
            {
                theme = ThemeDocument.Parse(part.GetInputStream());
            }
            catch (XmlException e)
            {
                throw new IOException(e.Message);
            }
        }
开发者ID:WPG,项目名称:npoi,代码行数:14,代码来源:ThemesTable.cs

示例7: ThemesTable

        /**
         * Construct a ThemesTable.
         * @param part A PackagePart.
         * @param rel A PackageRelationship.
         */
        internal ThemesTable(PackagePart part, PackageRelationship rel)
            : base(part, rel)
        {

            XmlDocument xmldoc = ConvertStreamToXml(part.GetInputStream());
                
            try
            {
                theme = ThemeDocument.Parse(xmldoc, NamespaceManager);
            }
            catch (XmlException e)
            {
                throw new IOException(e.Message);
            }
        }
开发者ID:twxstar,项目名称:npoi,代码行数:20,代码来源:ThemesTable.cs

示例8: POIXMLProperties

        public POIXMLProperties(OPCPackage docPackage)
        {
            this.pkg = docPackage;

            // Core properties
            core = new CoreProperties((PackagePropertiesPart)pkg.GetPackageProperties());

            // Extended properties
            PackageRelationshipCollection extRel =
                pkg.GetRelationshipsByType(PackageRelationshipTypes.EXTENDED_PROPERTIES);
            if (extRel.Size == 1)
            {
                extPart = pkg.GetPart(extRel.GetRelationship(0));
                ExtendedPropertiesDocument props = ExtendedPropertiesDocument.Parse(
                     extPart.GetInputStream()
                );
                ext = new ExtendedProperties(props);
            }
            else
            {
                extPart = null;
                ext = new ExtendedProperties((ExtendedPropertiesDocument)NEW_EXT_INSTANCE.Copy());
            }

            // Custom properties
            PackageRelationshipCollection custRel =
                pkg.GetRelationshipsByType(PackageRelationshipTypes.CUSTOM_PROPERTIES);
            if (custRel.Size == 1)
            {
                custPart = pkg.GetPart(custRel.GetRelationship(0));
                CustomPropertiesDocument props = CustomPropertiesDocument.Parse(
                        custPart.GetInputStream()
                );
                cust = new CustomProperties(props);
            }
            else
            {
                custPart = null;
                cust = new CustomProperties((CustomPropertiesDocument)NEW_CUST_INSTANCE.Copy());
            }
        }
开发者ID:xoposhiy,项目名称:npoi,代码行数:41,代码来源:POIXMLProperties.cs

示例9: SingleXmlCells

        internal SingleXmlCells(PackagePart part, PackageRelationship rel)
            : base(part, rel)
        {

            ReadFrom(part.GetInputStream());
        }
开发者ID:ctddjyds,项目名称:npoi,代码行数:6,代码来源:SingleXmlCells.cs

示例10: GetImageDimension

 /**
  * Return the dimension of this image
  *
  * @param part the namespace part holding raw picture data
  * @param type type of the picture: {@link Workbook#PICTURE_TYPE_JPEG},
  * {@link Workbook#PICTURE_TYPE_PNG} or {@link Workbook#PICTURE_TYPE_DIB}
  *
  * @return image dimension in pixels
  */
 protected static Size GetImageDimension(PackagePart part, PictureType type)
 {
     try
     {
         //return Image.FromStream(part.GetInputStream()).Size;
         //java can only read png,jpeg,dib image
         //C# read the image that format defined by PictureType , maybe.
         return ImageUtils.GetImageDimension(part.GetInputStream());
     }
     catch (IOException e)
     {
         //return a "singulariry" if ImageIO failed to read the image
         logger.Log(POILogger.WARN, e);
         return new Size();
     }
 }
开发者ID:newlysoft,项目名称:npoi,代码行数:25,代码来源:XSSFPicture.cs

示例11: MapInfo

        internal MapInfo(PackagePart part, PackageRelationship rel)
            : base(part, rel)
        {

            ReadFrom(part.GetInputStream());
        }
开发者ID:hanwangkun,项目名称:npoi,代码行数:6,代码来源:MapInfo.cs

示例12: SharedStringsTable

        internal SharedStringsTable(PackagePart part, PackageRelationship rel)
            : base(part, rel)
        {

            var xml = ConvertStreamToXml(part.GetInputStream());
            ReadFrom(xml);
        }
开发者ID:ngnono,项目名称:npoi,代码行数:7,代码来源:SharedStringsTable.cs

示例13: CommentsTable

        internal CommentsTable(PackagePart part, PackageRelationship rel)
            : base(part, rel)
        {

            ReadFrom(part.GetInputStream());
        }
开发者ID:ctddjyds,项目名称:npoi,代码行数:6,代码来源:CommentsTable.cs

示例14: ExternalLinksTable

 internal ExternalLinksTable(PackagePart part, PackageRelationship rel)
     : base(part, rel)
 {
     ;
     ReadFrom(part.GetInputStream());
 }
开发者ID:Reinakumiko,项目名称:npoi,代码行数:6,代码来源:ExternalLinksTable.cs

示例15: MapInfo

 internal MapInfo(PackagePart part, PackageRelationship rel)
     : base(part, rel)
 {
     xml = ConvertStreamToXml(part.GetInputStream());
     ReadFrom(xml);
 }
开发者ID:qljiong,项目名称:npoi,代码行数:6,代码来源:MapInfo.cs


注:本文中的NPOI.OpenXml4Net.OPC.PackagePart.GetInputStream方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。