get/set image size (inches) helpermaster
| @@ -1,5 +1,5 @@ | |||
| <?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> | |||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||
| @@ -10,7 +10,7 @@ | |||
| <AppDesignerFolder>Properties</AppDesignerFolder> | |||
| <RootNamespace>Novacode</RootNamespace> | |||
| <AssemblyName>DocX</AssemblyName> | |||
| <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | |||
| <TargetFrameworkVersion>v4.6</TargetFrameworkVersion> | |||
| <FileAlignment>512</FileAlignment> | |||
| <SccProjectName>SAK</SccProjectName> | |||
| <SccLocalPath>SAK</SccLocalPath> | |||
| @@ -51,6 +51,7 @@ | |||
| <DocumentationFile>bin\Debug\DocX.XML</DocumentationFile> | |||
| <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> | |||
| <NoWarn>CS1591</NoWarn> | |||
| <Prefer32Bit>false</Prefer32Bit> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||
| <DebugType>pdbonly</DebugType> | |||
| @@ -66,6 +67,7 @@ | |||
| <DebugSymbols>true</DebugSymbols> | |||
| <DocumentationFile>bin\Release\DocX.XML</DocumentationFile> | |||
| <NoWarn>CS1591</NoWarn> | |||
| <Prefer32Bit>false</Prefer32Bit> | |||
| </PropertyGroup> | |||
| <PropertyGroup> | |||
| <SignAssembly>true</SignAssembly> | |||
| @@ -80,7 +82,7 @@ | |||
| <RequiredTargetFramework>3.5</RequiredTargetFramework> | |||
| </Reference> | |||
| <Reference Include="System.Drawing" /> | |||
| <Reference Include="System.XML" /> | |||
| <Reference Include="System.Xml" /> | |||
| <Reference Include="System.Xml.Linq"> | |||
| <RequiredTargetFramework>3.5</RequiredTargetFramework> | |||
| </Reference> | |||
| @@ -338,7 +338,7 @@ namespace Novacode | |||
| { | |||
| return img.FileName; | |||
| } | |||
| } | |||
| } | |||
| /// <summary> | |||
| /// Get or sets the Width of this Image. | |||
| @@ -372,11 +372,47 @@ namespace Novacode | |||
| } | |||
| } | |||
| // 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() | |||
| //{ | |||
| // // Remove xml | |||
| // i.Remove(); | |||
| // // Rebuild the image collection for this paragraph | |||
| // // Requires that every Image have a link to its paragraph | |||
| @@ -2417,6 +2417,16 @@ | |||
| Get or sets the height of this Image. | |||
| </summary> | |||
| </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"> | |||
| <summary> | |||
| Represents a document paragraph. | |||
| @@ -3144,6 +3154,17 @@ | |||
| <param name="name">The name of this Picture.</param> | |||
| <param name="descr">The description of this Picture.</param> | |||
| </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)"> | |||
| <summary> | |||
| Creates an Edit either a ins or a del with the specified content and date | |||
| @@ -4603,7 +4624,7 @@ | |||
| </code> | |||
| </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="P:Novacode.Paragraph.Pictures"/> | |||
| <seealso cref="M:Novacode.Paragraph.InsertPicture(Novacode.Picture,System.Int32)"/> | |||
| @@ -5135,7 +5156,7 @@ | |||
| <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> | |||
| </member> | |||
| <member name="M:Novacode.DocX.AddImage(System.String,System.String)"> | |||
| <member name="M:Novacode.DocX.AddImage(System.String)"> | |||
| <summary> | |||
| Add an Image into this document from a fully qualified or relative filename. | |||
| </summary> | |||
| @@ -5184,7 +5205,7 @@ | |||
| } | |||
| </code> | |||
| </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)"/> | |||
| </member> | |||
| <member name="M:Novacode.DocX.AddHyperlink(System.String,System.Uri)"> | |||
| @@ -1,5 +1,5 @@ | |||
| <?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> | |||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||
| <Platform Condition=" '$(Platform)' == '' ">x86</Platform> | |||
| @@ -10,7 +10,7 @@ | |||
| <AppDesignerFolder>Properties</AppDesignerFolder> | |||
| <RootNamespace>Examples</RootNamespace> | |||
| <AssemblyName>Examples</AssemblyName> | |||
| <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | |||
| <TargetFrameworkVersion>v4.6</TargetFrameworkVersion> | |||
| <TargetFrameworkProfile> | |||
| </TargetFrameworkProfile> | |||
| <FileAlignment>512</FileAlignment> | |||
| @@ -29,6 +29,7 @@ | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| <UseVSHostingProcess>true</UseVSHostingProcess> | |||
| <Prefer32Bit>false</Prefer32Bit> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> | |||
| <PlatformTarget>AnyCPU</PlatformTarget> | |||
| @@ -38,14 +39,17 @@ | |||
| <DefineConstants>TRACE</DefineConstants> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| <Prefer32Bit>false</Prefer32Bit> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"> | |||
| <PlatformTarget>AnyCPU</PlatformTarget> | |||
| <OutputPath>bin\Debug\</OutputPath> | |||
| <Prefer32Bit>false</Prefer32Bit> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'"> | |||
| <PlatformTarget>AnyCPU</PlatformTarget> | |||
| <OutputPath>bin\Release\</OutputPath> | |||
| <Prefer32Bit>false</Prefer32Bit> | |||
| </PropertyGroup> | |||
| <ItemGroup> | |||
| <Reference Include="System" /> | |||
| @@ -1,3 +1,3 @@ | |||
| <?xml version="1.0"?> | |||
| <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> | |||
| @@ -1,5 +1,5 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <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" /> | |||
| </packages> | |||
| @@ -1,5 +1,5 @@ | |||
| <?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> | |||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||
| @@ -11,7 +11,7 @@ | |||
| <AppDesignerFolder>Properties</AppDesignerFolder> | |||
| <RootNamespace>UnitTests</RootNamespace> | |||
| <AssemblyName>UnitTests</AssemblyName> | |||
| <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | |||
| <TargetFrameworkVersion>v4.6</TargetFrameworkVersion> | |||
| <FileAlignment>512</FileAlignment> | |||
| <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | |||
| <SccProjectName>SAK</SccProjectName> | |||
| @@ -20,6 +20,7 @@ | |||
| <SccProvider>SAK</SccProvider> | |||
| <NuGetPackageImportStamp> | |||
| </NuGetPackageImportStamp> | |||
| <TargetFrameworkProfile /> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||
| <DebugSymbols>true</DebugSymbols> | |||
| @@ -29,6 +30,7 @@ | |||
| <DefineConstants>DEBUG;TRACE</DefineConstants> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| <Prefer32Bit>false</Prefer32Bit> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||
| <DebugType>pdbonly</DebugType> | |||
| @@ -37,6 +39,7 @@ | |||
| <DefineConstants>TRACE</DefineConstants> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| <Prefer32Bit>false</Prefer32Bit> | |||
| </PropertyGroup> | |||
| <PropertyGroup> | |||
| <SignAssembly>true</SignAssembly> | |||
| @@ -1,6 +1,6 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <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.ConsoleRunner" version="3.4.1" targetFramework="net40" /> | |||
| <package id="NUnit.Extension.NUnitProjectLoader" version="3.4.1" targetFramework="net40" /> | |||