openmcdf: Unrecognized OLEProperties Streams

Apart SummaryInformation and DocumentSummaryInformation there are more OLEProperties streams; it seems they all have the “|” character at the beginning of its name.

I did open one of those with the usual command and I’m able to read the OLEProperties, however, if I change them and save they are not accessible anymore

here an example:

Dim cfg As CFSConfiguration = CFSConfiguration.SectorRecycle Or CFSConfiguration.EraseFreeSectors
Dim fs = New FileStream("C:\Users\stazione41\Documents\cil2.par", FileMode.Open, FileAccess.ReadWrite)

Using cf As CompoundFile = New CompoundFile(fs, CFSUpdateMode.Update, cfg)

    Dim dsiStream3 As CFStream = cf.RootStorage.GetStream("Rfunnyd1AvtdbfkuIaamtae3Ie")
    Dim co3 As OLEPropertiesContainer = dsiStream3.AsOLEPropertiesContainer

    Dim DocumentNumber = co3.Properties.First(Function(Prop) Prop.PropertyName = "Document Number")
    Dim Revision = co3.Properties.First(Function(Prop) Prop.PropertyName = "Revision")
    Dim ProjectName = co3.Properties.First(Function(Prop) Prop.PropertyName = "Project Name")

    DocumentNumber.Value = "ABC"
    Revision.Value = "123"
    ProjectName.Value = "EDEF"

    co3.Save(dsiStream3)

    cf.Commit()

End Using

The first time you run the code it seems everything ok, but if you run it a second time you will get an error in reading the OLEProperties. Example document.file with those stream in attachment

This is how the OLEProperties stream are shown in another application image

cil2.zip

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

I confirm it works as a charm image

@farfilli The changes I was proposing to fix the issues discussed here have been merged into the master branch now - are you able to test if the changes have fixed your problems?

So, testing with other PropertySets that contain VT_R8 Types values the write method throws an exception "Unable to cast object of type ‘System.Int32’ to type ‘System.Double’

The stream on my file is this “\u0005K4teagxwOttdbfkuIaamtae3Ie”

Writing VT_LPWSTR on that set works fine so your changes #135 and @Numpsy 0c1d353 working greatly.

EDIT: I was passing the number as integer instead of double, declaring it as double before passing it works well