本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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());
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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());
}
}
示例9: SingleXmlCells
internal SingleXmlCells(PackagePart part, PackageRelationship rel)
: base(part, rel)
{
ReadFrom(part.GetInputStream());
}
示例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();
}
}
示例11: MapInfo
internal MapInfo(PackagePart part, PackageRelationship rel)
: base(part, rel)
{
ReadFrom(part.GetInputStream());
}
示例12: SharedStringsTable
internal SharedStringsTable(PackagePart part, PackageRelationship rel)
: base(part, rel)
{
var xml = ConvertStreamToXml(part.GetInputStream());
ReadFrom(xml);
}
示例13: CommentsTable
internal CommentsTable(PackagePart part, PackageRelationship rel)
: base(part, rel)
{
ReadFrom(part.GetInputStream());
}
示例14: ExternalLinksTable
internal ExternalLinksTable(PackagePart part, PackageRelationship rel)
: base(part, rel)
{
;
ReadFrom(part.GetInputStream());
}
示例15: MapInfo
internal MapInfo(PackagePart part, PackageRelationship rel)
: base(part, rel)
{
xml = ConvertStreamToXml(part.GetInputStream());
ReadFrom(xml);
}