I've just made a small test of difference ways to create a word document in the file system and then use it to programatically create documents in a document library with properties.
Create not using SharePoint
Create document/template from scrach in Word. Add Custom properties. Add Quick Part using Field|DocProperty|Property. Save to file system
Result:
Properties showing in Quick Part: Value from source
Properties showing in DIP/File|Info: Value from program/SP
Create using contenttype in SharePoint save to file system
Go to Document library with properties. Click New Document(or your contenttype) button in Ribbon. Add Quick Part using Document Property|Property. Save to file system<
Result:
Properties showing in Quick Part: Value from program/SP
Properties showing in DIP/File|Info: Value from program/SP
Create using contenttype in SharePoint extract to file system
Go to Document library with properties. Click New Document(or your contenttype) button in Ribbon. Add Quick Part using Document Property|Property. Save to Document library. Use program to extract to file system
Result:
Properties showing in Quick Part: Value from program/SP
Properties showing in DIP/File|Info: Value from program/SP
Conclusion
So it seems that the important part is to use SharePoint to create the document based on your contenttype, so that it gets the properties in the right way.
I also ran a test creating the documents in SP programatically, extracting them from SP into file system programatically and then opening them in word. And the result was the exact same as opening directly from SP. So if SP is allowed to create the properties in the first place it seems it's capable of maintaining it without help from the client program.
Test performed on SP2010 Enterprise. Documents create using Word 2010 as .docx files.
This is the code used to extract the document in the last test:
using System.IO;
using Microsoft.SharePoint;
namespace ExtractDocument
{
class Program
{
static void Main(string[] args)
{
using (var site =new SPSite("http://sp2010"))
using (var web = site.OpenWeb())
{
var doclib = web.GetList("MyDocLib") as SPDocumentLibrary;
foreach (SPFile source in doclib.RootFolder.Files)
{
File.WriteAllBytes(string.Format("C:\\testdocs2\\{0}", source.Name), source.OpenBinary());
}
}
}
}
}
And this is the code used to create documents based on the content from the file system:
using System;
using System.Collections;
using System.IO;
using Microsoft.SharePoint;
namespace GenerateDocuments
{
class Program
{
static void Main(string[] args)
{
using (var site = new SPSite("http://sp2010"))
using (var web = site.OpenWeb())
{
var doclib = web.GetList("MyDocLib") as SPDocumentLibrary;
foreach (var sourceName in Directory.GetFiles("C:\\testdocs"))
{
var source = new FileInfo(sourceName);
Console.WriteLine(source.Name);
doclib.RootFolder.Files.Add(source.Name, File.ReadAllBytes(sourceName), new Hashtable { { "Property1", "From Create" }, { "Property2", "From Create" } });
}
}
}
}
}