get/set image size (inches) helpermaster
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||||
| <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||||
| <PropertyGroup> | <PropertyGroup> | ||||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||||
| <AppDesignerFolder>Properties</AppDesignerFolder> | <AppDesignerFolder>Properties</AppDesignerFolder> | ||||
| <RootNamespace>Novacode</RootNamespace> | <RootNamespace>Novacode</RootNamespace> | ||||
| <AssemblyName>DocX</AssemblyName> | <AssemblyName>DocX</AssemblyName> | ||||
| <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | |||||
| <TargetFrameworkVersion>v4.6</TargetFrameworkVersion> | |||||
| <FileAlignment>512</FileAlignment> | <FileAlignment>512</FileAlignment> | ||||
| <SccProjectName>SAK</SccProjectName> | <SccProjectName>SAK</SccProjectName> | ||||
| <SccLocalPath>SAK</SccLocalPath> | <SccLocalPath>SAK</SccLocalPath> | ||||
| <DocumentationFile>bin\Debug\DocX.XML</DocumentationFile> | <DocumentationFile>bin\Debug\DocX.XML</DocumentationFile> | ||||
| <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> | <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> | ||||
| <NoWarn>CS1591</NoWarn> | <NoWarn>CS1591</NoWarn> | ||||
| <Prefer32Bit>false</Prefer32Bit> | |||||
| </PropertyGroup> | </PropertyGroup> | ||||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||||
| <DebugType>pdbonly</DebugType> | <DebugType>pdbonly</DebugType> | ||||
| <DebugSymbols>true</DebugSymbols> | <DebugSymbols>true</DebugSymbols> | ||||
| <DocumentationFile>bin\Release\DocX.XML</DocumentationFile> | <DocumentationFile>bin\Release\DocX.XML</DocumentationFile> | ||||
| <NoWarn>CS1591</NoWarn> | <NoWarn>CS1591</NoWarn> | ||||
| <Prefer32Bit>false</Prefer32Bit> | |||||
| </PropertyGroup> | </PropertyGroup> | ||||
| <PropertyGroup> | <PropertyGroup> | ||||
| <SignAssembly>true</SignAssembly> | <SignAssembly>true</SignAssembly> | ||||
| <RequiredTargetFramework>3.5</RequiredTargetFramework> | <RequiredTargetFramework>3.5</RequiredTargetFramework> | ||||
| </Reference> | </Reference> | ||||
| <Reference Include="System.Drawing" /> | <Reference Include="System.Drawing" /> | ||||
| <Reference Include="System.XML" /> | |||||
| <Reference Include="System.Xml" /> | |||||
| <Reference Include="System.Xml.Linq"> | <Reference Include="System.Xml.Linq"> | ||||
| <RequiredTargetFramework>3.5</RequiredTargetFramework> | <RequiredTargetFramework>3.5</RequiredTargetFramework> | ||||
| </Reference> | </Reference> |
| { | { | ||||
| return img.FileName; | return img.FileName; | ||||
| } | } | ||||
| } | |||||
| } | |||||
| /// <summary> | /// <summary> | ||||
| /// Get or sets the Width of this Image. | /// Get or sets the Width of this Image. | ||||
| } | } | ||||
| } | } | ||||
| // refs: | |||||
| // https://startbigthinksmall.wordpress.com/2010/01/04/points-inches-and-emus-measuring-units-in-office-open-xml/ | |||||
| // http://lcorneliussen.de/raw/dashboards/ooxml/ | |||||
| private const int InchToEmuFactor = 914400; | |||||
| private const double EmuToInchFactor = 1d / InchToEmuFactor; | |||||
| /// <summary> | |||||
| /// Get or sets the Width of this Image (inches). | |||||
| /// </summary> | |||||
| public double WidthInches | |||||
| { | |||||
| get | |||||
| { | |||||
| return Width * EmusInPixel * EmuToInchFactor; | |||||
| } | |||||
| set | |||||
| { | |||||
| Width = (int)(value * InchToEmuFactor / EmusInPixel); | |||||
| } | |||||
| } | |||||
| /// <summary> | |||||
| /// Get or sets the Height of this Image (inches). | |||||
| /// </summary> | |||||
| public double HeightInches | |||||
| { | |||||
| get | |||||
| { | |||||
| return Height * EmusInPixel * EmuToInchFactor; | |||||
| } | |||||
| set | |||||
| { | |||||
| Height = (int)(value * InchToEmuFactor / EmusInPixel); | |||||
| } | |||||
| } | |||||
| //public void Delete() | //public void Delete() | ||||
| //{ | //{ | ||||
| // // Remove xml | // // Remove xml | ||||
| // i.Remove(); | // i.Remove(); | ||||
| // // Rebuild the image collection for this paragraph | // // Rebuild the image collection for this paragraph | ||||
| // // Requires that every Image have a link to its paragraph | // // Requires that every Image have a link to its paragraph | ||||
| Get or sets the height of this Image. | Get or sets the height of this Image. | ||||
| </summary> | </summary> | ||||
| </member> | </member> | ||||
| <member name="P:Novacode.Picture.WidthInches"> | |||||
| <summary> | |||||
| Get or sets the Width of this Image (inches). | |||||
| </summary> | |||||
| </member> | |||||
| <member name="P:Novacode.Picture.HeightInches"> | |||||
| <summary> | |||||
| Get or sets the Height of this Image (inches). | |||||
| </summary> | |||||
| </member> | |||||
| <member name="T:Novacode.Paragraph"> | <member name="T:Novacode.Paragraph"> | ||||
| <summary> | <summary> | ||||
| Represents a document paragraph. | Represents a document paragraph. | ||||
| <param name="name">The name of this Picture.</param> | <param name="name">The name of this Picture.</param> | ||||
| <param name="descr">The description of this Picture.</param> | <param name="descr">The description of this Picture.</param> | ||||
| </member> | </member> | ||||
| <member name="M:Novacode.Paragraph.ReplacePicture(Novacode.Picture,Novacode.Picture)"> | |||||
| <summary> | |||||
| Replaces a Picture with a new one. | |||||
| </summary> | |||||
| <remarks> | |||||
| Only the content of the picture will be replaced - positioning inside the document and all other attributes will be preserved. | |||||
| </remarks> | |||||
| <param name="toBeReplaced">The picture object to be replaced.</param> | |||||
| <param name="replaceWith">The picture object that should be inserted instead of <paramref name="toBeReplaced"/>.</param> | |||||
| <returns>The new <see cref="T:Novacode.Picture"/> object that replaces the old one.</returns> | |||||
| </member> | |||||
| <member name="M:Novacode.Paragraph.CreateEdit(Novacode.EditType,System.DateTime,System.Object)"> | <member name="M:Novacode.Paragraph.CreateEdit(Novacode.EditType,System.DateTime,System.Object)"> | ||||
| <summary> | <summary> | ||||
| Creates an Edit either a ins or a del with the specified content and date | Creates an Edit either a ins or a del with the specified content and date | ||||
| </code> | </code> | ||||
| </example> | </example> | ||||
| <seealso cref="M:Novacode.DocX.AddImage(System.String,System.String)"/> | |||||
| <seealso cref="!:AddImage(string, string)"/> | |||||
| <seealso cref="M:Novacode.DocX.AddImage(System.IO.Stream,System.String)"/> | <seealso cref="M:Novacode.DocX.AddImage(System.IO.Stream,System.String)"/> | ||||
| <seealso cref="P:Novacode.Paragraph.Pictures"/> | <seealso cref="P:Novacode.Paragraph.Pictures"/> | ||||
| <seealso cref="M:Novacode.Paragraph.InsertPicture(Novacode.Picture,System.Int32)"/> | <seealso cref="M:Novacode.Paragraph.InsertPicture(Novacode.Picture,System.Int32)"/> | ||||
| <param name="templateStream">The stream of the document template file.</param> | <param name="templateStream">The stream of the document template file.</param> | ||||
| <param name="includeContent">Whether to copy the document template text content to document.</param> | <param name="includeContent">Whether to copy the document template text content to document.</param> | ||||
| </member> | </member> | ||||
| <member name="M:Novacode.DocX.AddImage(System.String,System.String)"> | |||||
| <member name="M:Novacode.DocX.AddImage(System.String)"> | |||||
| <summary> | <summary> | ||||
| Add an Image into this document from a fully qualified or relative filename. | Add an Image into this document from a fully qualified or relative filename. | ||||
| </summary> | </summary> | ||||
| } | } | ||||
| </code> | </code> | ||||
| </example> | </example> | ||||
| <seealso cref="M:Novacode.DocX.AddImage(System.String,System.String)"/> | |||||
| <seealso cref="!:AddImage(string, string)"/> | |||||
| <seealso cref="M:Novacode.Paragraph.InsertPicture(Novacode.Picture,System.Int32)"/> | <seealso cref="M:Novacode.Paragraph.InsertPicture(Novacode.Picture,System.Int32)"/> | ||||
| </member> | </member> | ||||
| <member name="M:Novacode.DocX.AddHyperlink(System.String,System.Uri)"> | <member name="M:Novacode.DocX.AddHyperlink(System.String,System.Uri)"> |
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||||
| <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||||
| <PropertyGroup> | <PropertyGroup> | ||||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||||
| <Platform Condition=" '$(Platform)' == '' ">x86</Platform> | <Platform Condition=" '$(Platform)' == '' ">x86</Platform> | ||||
| <AppDesignerFolder>Properties</AppDesignerFolder> | <AppDesignerFolder>Properties</AppDesignerFolder> | ||||
| <RootNamespace>Examples</RootNamespace> | <RootNamespace>Examples</RootNamespace> | ||||
| <AssemblyName>Examples</AssemblyName> | <AssemblyName>Examples</AssemblyName> | ||||
| <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | |||||
| <TargetFrameworkVersion>v4.6</TargetFrameworkVersion> | |||||
| <TargetFrameworkProfile> | <TargetFrameworkProfile> | ||||
| </TargetFrameworkProfile> | </TargetFrameworkProfile> | ||||
| <FileAlignment>512</FileAlignment> | <FileAlignment>512</FileAlignment> | ||||
| <ErrorReport>prompt</ErrorReport> | <ErrorReport>prompt</ErrorReport> | ||||
| <WarningLevel>4</WarningLevel> | <WarningLevel>4</WarningLevel> | ||||
| <UseVSHostingProcess>true</UseVSHostingProcess> | <UseVSHostingProcess>true</UseVSHostingProcess> | ||||
| <Prefer32Bit>false</Prefer32Bit> | |||||
| </PropertyGroup> | </PropertyGroup> | ||||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> | ||||
| <PlatformTarget>AnyCPU</PlatformTarget> | <PlatformTarget>AnyCPU</PlatformTarget> | ||||
| <DefineConstants>TRACE</DefineConstants> | <DefineConstants>TRACE</DefineConstants> | ||||
| <ErrorReport>prompt</ErrorReport> | <ErrorReport>prompt</ErrorReport> | ||||
| <WarningLevel>4</WarningLevel> | <WarningLevel>4</WarningLevel> | ||||
| <Prefer32Bit>false</Prefer32Bit> | |||||
| </PropertyGroup> | </PropertyGroup> | ||||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"> | <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"> | ||||
| <PlatformTarget>AnyCPU</PlatformTarget> | <PlatformTarget>AnyCPU</PlatformTarget> | ||||
| <OutputPath>bin\Debug\</OutputPath> | <OutputPath>bin\Debug\</OutputPath> | ||||
| <Prefer32Bit>false</Prefer32Bit> | |||||
| </PropertyGroup> | </PropertyGroup> | ||||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'"> | <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'"> | ||||
| <PlatformTarget>AnyCPU</PlatformTarget> | <PlatformTarget>AnyCPU</PlatformTarget> | ||||
| <OutputPath>bin\Release\</OutputPath> | <OutputPath>bin\Release\</OutputPath> | ||||
| <Prefer32Bit>false</Prefer32Bit> | |||||
| </PropertyGroup> | </PropertyGroup> | ||||
| <ItemGroup> | <ItemGroup> | ||||
| <Reference Include="System" /> | <Reference Include="System" /> |
| <?xml version="1.0"?> | <?xml version="1.0"?> | ||||
| <configuration> | <configuration> | ||||
| <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration> | |||||
| <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/></startup></configuration> |
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||
| <packages> | <packages> | ||||
| <package id="NUnit" version="3.6.0" targetFramework="net40" /> | |||||
| <package id="NUnit" version="3.6.0" targetFramework="net40" requireReinstallation="true" /> | |||||
| <package id="NUnitTestAdapter" version="2.0.0" targetFramework="net40" /> | <package id="NUnitTestAdapter" version="2.0.0" targetFramework="net40" /> | ||||
| </packages> | </packages> |
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||||
| <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||||
| <PropertyGroup> | <PropertyGroup> | ||||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||||
| <AppDesignerFolder>Properties</AppDesignerFolder> | <AppDesignerFolder>Properties</AppDesignerFolder> | ||||
| <RootNamespace>UnitTests</RootNamespace> | <RootNamespace>UnitTests</RootNamespace> | ||||
| <AssemblyName>UnitTests</AssemblyName> | <AssemblyName>UnitTests</AssemblyName> | ||||
| <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | |||||
| <TargetFrameworkVersion>v4.6</TargetFrameworkVersion> | |||||
| <FileAlignment>512</FileAlignment> | <FileAlignment>512</FileAlignment> | ||||
| <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||||
| <SccProjectName>SAK</SccProjectName> | <SccProjectName>SAK</SccProjectName> | ||||
| <SccProvider>SAK</SccProvider> | <SccProvider>SAK</SccProvider> | ||||
| <NuGetPackageImportStamp> | <NuGetPackageImportStamp> | ||||
| </NuGetPackageImportStamp> | </NuGetPackageImportStamp> | ||||
| <TargetFrameworkProfile /> | |||||
| </PropertyGroup> | </PropertyGroup> | ||||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||||
| <DebugSymbols>true</DebugSymbols> | <DebugSymbols>true</DebugSymbols> | ||||
| <DefineConstants>DEBUG;TRACE</DefineConstants> | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||||
| <ErrorReport>prompt</ErrorReport> | <ErrorReport>prompt</ErrorReport> | ||||
| <WarningLevel>4</WarningLevel> | <WarningLevel>4</WarningLevel> | ||||
| <Prefer32Bit>false</Prefer32Bit> | |||||
| </PropertyGroup> | </PropertyGroup> | ||||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||||
| <DebugType>pdbonly</DebugType> | <DebugType>pdbonly</DebugType> | ||||
| <DefineConstants>TRACE</DefineConstants> | <DefineConstants>TRACE</DefineConstants> | ||||
| <ErrorReport>prompt</ErrorReport> | <ErrorReport>prompt</ErrorReport> | ||||
| <WarningLevel>4</WarningLevel> | <WarningLevel>4</WarningLevel> | ||||
| <Prefer32Bit>false</Prefer32Bit> | |||||
| </PropertyGroup> | </PropertyGroup> | ||||
| <PropertyGroup> | <PropertyGroup> | ||||
| <SignAssembly>true</SignAssembly> | <SignAssembly>true</SignAssembly> |
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||
| <packages> | <packages> | ||||
| <package id="NUnit" version="3.6.0" targetFramework="net40" /> | |||||
| <package id="NUnit" version="3.6.0" targetFramework="net40" requireReinstallation="true" /> | |||||
| <package id="NUnit.Console" version="3.4.1" targetFramework="net40" /> | <package id="NUnit.Console" version="3.4.1" targetFramework="net40" /> | ||||
| <package id="NUnit.ConsoleRunner" version="3.4.1" targetFramework="net40" /> | <package id="NUnit.ConsoleRunner" version="3.4.1" targetFramework="net40" /> | ||||
| <package id="NUnit.Extension.NUnitProjectLoader" version="3.4.1" targetFramework="net40" /> | <package id="NUnit.Extension.NUnitProjectLoader" version="3.4.1" targetFramework="net40" /> |