Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Hiding and Storing/caching of Application Specific data in MS Word 2003 documents

, 9 Oct 2008 CPOL
Proof of concept on how the application specific (small/large amount of) data can be stored in ms word document as well as how it can be made hidden from end user’s eye.
Proof_Of_Concept.zip
Common
Common
bin
Debug
Release
Common.dll
Common.pdb
obj
Debug
TempPE
Release
Common.dll
Common.pdb
TempPE
Properties
Common.suo
DocumentIDReader
DocumentIDReader
bin
Debug
Release
DocumentIDReader.exe
DocumentIDReader.pdb
DocumentIDReader.vshost.exe
DocumentIDReader.csproj.user
obj
Debug
TempPE
Release
DocumentIDReader.csproj.GenerateResource.Cache
DocumentIDReader.exe
DocumentIDReader.Form1.resources
DocumentIDReader.pdb
DocumentIDReader.Properties.Resources.resources
TempPE
Properties
Settings.settings
DocumentIDReader.suo
FileStorage
FileStorage
FileStorage.def
FileStorage.vcproj.NECHCLDC01.atul.suyal.user
FileStorage.vcproj.NECHCLDC01.vinita.batra.user
FileStorage.vcproj.RAIREKI.mahendra.gupta.user
res
vssver2.scc
vssver2.scc
FileStorage.suo
SocketServer
SocketServer
bin
Release
Common.dll
Common.pdb
SocketServer.exe
SocketServer.pdb
SocketServer.vshost.exe
obj
Debug
SocketServer.exe
SocketServer.pdb
TempPE
Release
SocketServer.exe
SocketServer.pdb
TempPE
Properties
SocketServer.csproj.user
SocketServer.suo
WordAddIn1
WordAddIn1
bin
Debug
Common.dll
Common.pdb
WordAddIn1.dll
WordAddIn1.dll.manifest
WordAddIn1.pdb
obj
Debug
TempPE
WordAddIn1.csproj.GenerateResource.Cache
WordAddIn1.csproj.ResolveComReference.cache
WordAddIn1.dll
WordAddIn1.pdb
WordAddIn1.Properties.Resources.resources
Properties
Settings.settings
WordAddIn1.csproj.user
WordAddIn1.suo
WordAddIn1Setup
Debug
Release
WordAddIn1Setup
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!-- This section defines project level properties.
         
         Configuration : Specifies a default value for debug.
         Platform : Specifies what CPU the output of this project can run on.
         OutputType : Must be "Library" for VSTO.
         NoStandardLibraries : Set to "false" for VSTO.
         RootNamespace : In C#, this specifies the namespace given to new files. In VB, all objects are wrapped in
                         this namespace at runtime.
         AssemblyName : Name of the output assembly. -->
  <PropertyGroup>
    <ProjectTypeGuids>{BAA0C2D2-18E2-41B9-852F-F413020CAA33};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{CC222EAD-CE14-41E9-A2A5-708AF623FF8F}</ProjectGuid>
    <OutputType>Library</OutputType>
    <NoStandardLibraries>false</NoStandardLibraries>
    <RootNamespace>WordAddIn1</RootNamespace>
    <AssemblyName>WordAddIn1</AssemblyName>
  </PropertyGroup>
  <PropertyGroup>
    <!-- 
        VSTO_TrustAssembliesLocation - If true, VSTO gives the project output full trust in user-
              level policy when the project is built.
        VSTO_HostDocumentName - Not used in addins.
    -->
    <VSTO_TrustAssembliesLocation>true</VSTO_TrustAssembliesLocation>
  </PropertyGroup>
  <PropertyGroup>
    <!--
        properites needed to register addins
        AddinRegistryHive - Root registry hive for the addin
        AddinRegistryKey  - Registry key where this addin is registered
    -->
    <AddinRegistryHive>CurrentUser</AddinRegistryHive>
    <AddinRegistryKey>Software\Microsoft\Office\Word\Addins</AddinRegistryKey>
  </PropertyGroup>
  <!-- This section defines properties that are set when the "Debug" configuration is 
       selected. 
       DebugSymbols - If true, create symbols (.pdb). If false, do not create symbols.
       Optimize - If true, optimize the build output. If false, do not optimize.
       OutputPath - Output path of project relative to the project file.
       EnableUnmanagedDebugging - If true, starting the debugger will attach both managed and unmanaged debuggers.
       DefineConstants - Constants defined for the preprocessor.
       Warning Level - Warning level for the compiler.
  -->
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>.\bin\Debug\</OutputPath>
    <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <!-- This section defines properties that are set when the "Release" configuration is 
       selected.
       DebugSymbols - If true, create symbols (.pdb). If false, do not create symbols.
       Optimize - If true, optimize the build output. If false, do not optimize.
       OutputPath - Output path of project relative to the project file.
       EnableUnmanagedDebugging - If true, starting the debugger will attach both managed and unmanaged debuggers.
       DefineConstants - Constants defined for the preprocessor.
       Warning Level - Warning level for the compiler.
  -->
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>.\bin\Release\</OutputPath>
    <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
    <DefineConstants>TRACE</DefineConstants>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <!-- This section enables pre and post build steps. However, 
       in VSTO use MSBuild tasks instead of these properties.       
  -->
  <PropertyGroup>
    <PreBuildEvent>
    </PreBuildEvent>
    <PostBuildEvent>
    </PostBuildEvent>
  </PropertyGroup>
  <!--
     This sections specifies references for the project.
  -->
  <ItemGroup>
    <Reference Include="Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\Common\Common\bin\Release\Common.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.XML" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Drawing" />
    <Reference Include="Accessibility" />
    <Reference Include="Microsoft.VisualStudio.Tools.Applications.Runtime" />
    <Reference Include="Microsoft.Office.Tools.Common" />
  </ItemGroup>
  <!--
     This section specifies COM References for the project (managed assemblies that wrap unmanaged
     typelibs (tlb)). This is the equivalent of choosing "Add Reference->Com Reference" in the 
     IDE.
  -->
  <ItemGroup>
    <COMReference Include="Microsoft.Office.Core">
      <Guid>{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}</Guid>
      <VersionMajor>2</VersionMajor>
      <VersionMinor>3</VersionMinor>
      <WrapperTool>primary</WrapperTool>
    </COMReference>
    <COMReference Include="Word">
      <Guid>{00020905-0000-0000-C000-000000000046}</Guid>
      <VersionMajor>8</VersionMajor>
      <VersionMinor>3</VersionMinor>
      <WrapperTool>primary</WrapperTool>
    </COMReference>
    <COMReference Include="stdole">
      <Guid>{00020430-0000-0000-C000-000000000046}</Guid>
      <VersionMajor>2</VersionMajor>
      <VersionMinor>0</VersionMinor>
      <Lcid>0</Lcid>
      <WrapperTool>primary</WrapperTool>
      <Isolated>False</Isolated>
    </COMReference>
  </ItemGroup>
  <!--
     This section defines the user source files that are part of the
     project.
     
     A compile tag specifies a source file to compile.
     An EmbeddedResource tag specifies an .resx file for embedded resources.
     A None tag specifies a file that is not to be passed to the compiler (for instance, 
     a text file or XML file).
     The AppDesigner tag specifies the directory where the application properties files can
     be found.
  -->
  <ItemGroup>
    <Compile Include="CustomDocumentPropertyManager.cs" />
    <Compile Include="Properties\AssemblyInfo.cs">
      <SubType>Code</SubType>
    </Compile>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
      <SubType>Designer</SubType>
    </EmbeddedResource>
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <None Include="Properties\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    </None>
    <Compile Include="Properties\Settings.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
    </Compile>
    <Compile Include="ThisAddIn.cs">
      <SubType>Code</SubType>
    </Compile>
    <None Include="ThisAddIn.Designer.xml">
      <DependentUpon>ThisAddIn.cs</DependentUpon>
    </None>
    <Compile Include="ThisAddIn.Designer.cs">
      <DependentUpon>ThisAddIn.Designer.xml</DependentUpon>
    </Compile>
    <AppDesigner Include="Properties\" />
  </ItemGroup>
  <!-- Include the build rules for a C# project.-->
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- Include additional build rules for an office application addin -->
  <Import Project="$(MSBuildExtensionsPath)\Microsoft.VisualStudio.OfficeTools2.targets" />
  <!-- This section defines VSTO properties that describe the host-changable project properties. -->
  <ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{BAA0C2D2-18E2-41B9-852F-F413020CAA33}">
        <ProjectProperties HostName="Word" HostPackage="{D53BAEDE-5B63-42BE-8267-3DED11EDC582}" ApplicationType="Word" Language="cs" TemplatesPath="" DebugInfoExeName="#Software\Microsoft\Office\11.0\Word\InstallRoot\Path#WINWORD.EXE" DebugInfoCommandLine="/w" />
        <Host Name="Word" GeneratedCodeNamespace="WordAddIn1" IconIndex="0">
          <HostItem Name="ThisAddIn" Code="ThisAddIn.cs" CanonicalName="AddIn" CanActivate="false" IconIndex="1" Blueprint="ThisAddIn.Designer.xml" GeneratedCode="ThisAddIn.Designer.cs" />
        </Host>
        <ProjectClient>
          <VSTO_CompatibleProducts ErrorProduct="This project requires Microsoft Office Word 2003, but this application is not installed." ErrorPIA="This project references the primary interop assembly for Microsoft Office Word 2003, but this primary interop assembly is not installed.">
            <Product Code="{XXXXXXXX-6000-11D3-8CFE-0150048383C9}" Feature="WORDFiles" PIAFeature="Word_PIA" />
          </VSTO_CompatibleProducts>
        </ProjectClient>
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>
</Project>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

No Biography provided

| Advertise | Privacy | Mobile
Web02 | 2.8.141015.1 | Last Updated 10 Oct 2008
Article Copyright 2008 by batra.vinita@gmail.com
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid