How to set the document's author and title

Home Forums SpreadsheetML How to set the document's author and title

This topic contains 3 replies, has 2 voices, and was last updated by  Jim Snyder 7 years, 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #3928

    acarrano
    Participant

    Hi all,

    So far, I have successfully written a Spreadsheet document using Open XML SDK 2.5 and C#. I’ve got styles and content done, but I am unable to set the document’s author and title.

    I know that those values are set at ./docProps/core.xml. I’ve got this far:

    `SpreadsheetDocument doc = SpreadsheetDocument.Create(
    outputFilePath,
    preadsheetDocumentType.Workbook,
    true);

    CoreFilePropertiesPart cfpPart = doc.AddCoreFilePropertiesPart();
    // NOW WHAT?`

    I don’t know what to do with the cfpPart. Any help would be appreciated. Thanks,

    #3929

    Jim Snyder
    Participant

    I’ll admit I don’t know how to do it the way you are asking, but this is how I do it:
    ` private void SetPackageProperties(SpreadsheetDocument wkbk)
    {
    wkbk.PackageProperties.Creator = “Jim Snyder”;
    wkbk.PackageProperties.Created = DateTime.Now;
    wkbk.PackageProperties.Modified = DateTime.Now;
    wkbk.PackageProperties.LastModifiedBy = “Jim Snyder”;

    wkbk.PackageProperties.Category = “Regional Report”;
    wkbk.PackageProperties.Description = “Inventory Recon rpt.”;
    wkbk.PackageProperties.Subject = “Regional recon”;
    wkbk.PackageProperties.Title = “O’Bleness/AdviCare Inventory Recon – Daily”;
    }

    #3932

    acarrano
    Participant

    That worked perfectly. Thank you Jim.

    #3933

    Jim Snyder
    Participant

    I appreciate you saying thanks! Now I can go home on a Friday with a sense of accomplishment. ==;-)

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.