OfficeIMO

API Reference

Class

Helpers

Namespace OfficeIMO.Word
Assembly OfficeIMO.Word
Modifiers static

Provides helper methods for stream and file operations.

Inheritance

  • Object
  • Helpers

Methods

ConvertCentimetersToEmus(System.Double value) #

Converts centimeters to EMUs and returns int value

Parameters

value System.Double required
ConvertCentimetersToEmusInt64(System.Double value) #

Converts centimeters to EMUs and returns int64 value

Parameters

value System.Double required
ConvertCentimetersToPoints(System.Double cm) #

Converts centimeters to points

Parameters

cm System.Double required
ConvertCentimetersToTwentiethsOfPoint(System.Double cm) #

Converts centimeters to twentieths of a point

Parameters

cm System.Double required
ConvertCentimetersToTwips(System.Double cmValue) #

Converts centimeters to twips

Parameters

cmValue System.Double required
ConvertCentimetersToTwipsUInt32(System.Double cmValue) #

Converts centimeters to twips

Parameters

cmValue System.Double required
ConvertEmusToCentimeters 2 overloads
ConvertEmusToCentimeters(System.Int32 emusValue) #

Converts EMUs to centimeters

Parameters

emusValue System.Int32 required
ConvertEmusToCentimeters(System.Int64 emusValue) #

Converts EMUs to centimeters

Parameters

emusValue System.Int64 required
ConvertEmusToPoints(System.Int64 emusValue) #

Converts EMUs to points

Parameters

emusValue System.Int64 required
EMUs value.

Returns

Points value.

ConvertPointsToCentimeters(System.Double points) #

Converts the points to centimeters.

Parameters

points System.Double required
The points.
ConvertPointsToEmusInt64(System.Double points) #

Converts points to EMUs

Parameters

points System.Double required
Points value.

Returns

EMUs value.

ConvertPointsToTwips(System.Double points) #

Converts points to twips (twentieths of a point)

Parameters

points System.Double required
The points value.

Returns

Twips value.

ConvertPointsToTwipsUInt32(System.Double points) #

Converts points to twips (twentieths of a point)

Parameters

points System.Double required
The points value.

Returns

Twips value.

ConvertTwipsToCentimeters 2 overloads
ConvertTwipsToCentimeters(System.Int32 twipsValue) #

Converts twips to centimeters

Parameters

twipsValue System.Int32 required
ConvertTwipsToCentimeters(System.UInt32 twipsValue) #

Converts twips to centimeters

Parameters

twipsValue System.UInt32 required
ConvertTwipsToPoints 2 overloads
ConvertTwipsToPoints(System.Int32 twipsValue) #

Converts twips (twentieths of a point) to points

Parameters

twipsValue System.Int32 required
The value in twips.

Returns

Points value.

ConvertTwipsToPoints(System.UInt32 twipsValue) #

Converts twips (twentieths of a point) to points

Parameters

twipsValue System.UInt32 required
The value in twips.

Returns

Points value.

public static FileStream CopyFileAndOpenFileStream(String sourcePath, String destPath) #
Returns: FileStream

Copies a file and opens a file stream for the copied file.

Parameters

sourcePath System.String requiredposition: 0
The path of the source file.
destPath System.String requiredposition: 1
The path of the destination file.

Returns

A FileStream for the copied file.

public static FileStream CopyFileStreamToFileStream(String sourcePath, String destPath) #
Returns: FileStream

Copies the contents of one file stream to another file stream.

Parameters

sourcePath System.String requiredposition: 0
The path of the source file.
destPath System.String requiredposition: 1
The path of the destination file.

Returns

A FileStream for the destination file.

public static MemoryStream CopyFileStreamToMemoryStream(String path) #
Returns: MemoryStream

Copies the contents of a file stream to a MemoryStream.

Parameters

path System.String requiredposition: 0
The path of the file to read.

Returns

A MemoryStream containing the file's contents.

public static Void CopyStream(Stream source, Stream target) #
Returns: Void

Copies the contents of one stream to another stream.

Parameters

source System.IO.Stream requiredposition: 0
The source stream.
target System.IO.Stream requiredposition: 1
The target stream.
FixPartIfExists(System.IO.Packaging.Package package, System.Uri partUri, System.Boolean removeWordPrefix) #

Updates relationships for the specified part if it exists in the package.

Parameters

package System.IO.Packaging.Package required
Package to modify.
partUri System.Uri required
URI of the relationships part.
removeWordPrefix System.Boolean required
Whether to remove the /word prefix from targets.
FixRelationships(System.IO.Packaging.PackagePart relsPart, System.Boolean removeWordPrefix) #

Fixes relationship targets in the specified relationships part.

Parameters

relsPart System.IO.Packaging.PackagePart required
Relationship part to process.
removeWordPrefix System.Boolean required
Whether to remove the /word prefix from targets.
IsFileLocked 2 overloads
public static Boolean IsFileLocked(FileInfo file) #
Returns: Boolean

Checks if file is locked/used by another process

Parameters

file System.IO.FileInfo requiredposition: 0
public static Boolean IsFileLocked(String fileName) #
Returns: Boolean

Checks if file is locked/used by another process

Parameters

fileName System.String requiredposition: 0
MakeOpenOfficeCompatible 2 overloads
public static Void MakeOpenOfficeCompatible(Stream fileStream) #
Returns: Void

Adjusts relationship targets so that the document can be opened by OpenOffice.

Parameters

filePath System.String requiredposition: 0
Path to the document package.
MakeOpenOfficeCompatible(System.IO.Stream fileStream) #

Adjusts relationship targets for a document provided as a stream.

Parameters

fileStream System.IO.Stream required
Stream containing the document package.
NormalizeColor(System.String arg1) #

Normalizes color input which may be a hex value or a named color. Hex values may be specified as three or six digits, with or without '#'. Returns a lowercase six-digit hex string without '#'. Throws ArgumentException if the value cannot be parsed as a valid color.

Parameters

arg1 System.String required
public static Void Open(String filePath, Boolean open) #
Returns: Void

Opens up any file using assigned Application

Parameters

filePath System.String requiredposition: 0
open System.Boolean requiredposition: 1
ParseColor(System.String hex) #

Parses a color string that may or may not start with '#'.

Parameters

hex System.String required
Color value in hex without alpha or with '#'.
public static MemoryStream ReadAllBytesToMemoryStream(String path) #
Returns: MemoryStream

Reads all bytes from a file and writes them to a MemoryStream.

Parameters

path System.String requiredposition: 0
The path of the file to read.

Returns

A MemoryStream containing the file's bytes.

public static MemoryStream ReadFileToMemoryStream(String path) #
Returns: MemoryStream

Reads the contents of a file into a MemoryStream.

Parameters

path System.String requiredposition: 0
The path of the file to read.

Returns

A MemoryStream containing the file's contents.

public static String ToHexColor(Color c) #
Returns: String

Converts Color to Hex Color

Parameters

c SixLabors.ImageSharp.Color requiredposition: 0