2016-03-27 20 views
0

OPC-dosyam var. İyi çalışıyor. Şimdi küçük resim eklemeye çalışıyorum, bu yüzden bu dosya Windows Gezgini'nde veya örneğin tarayıcıda ek olarak gösterildiğinde küçük resmim görüntülenir. Windows Gezgini'nde bir OPC dosyasının küçük resmini göster

Ben dosyayı .rels için

<Relationship Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail" Target="/thumbnail.png" Id="RTN1" /> 

eklemeye çalıştı. Png yerine jpeg eklemeyi denedim. 32x32 ve 64x64 boyutlarını denedim.

[content_types] .xml: my dosyanın

<Default Extension="png" ContentType="image/png" /> 

veya <Default Extension="jpeg" ContentType="image/jpeg" />

Yapısı:

  • _rels
    • .rels
  • .xml

küçük resimle OPC-dosyayı çalışma kâr payı örneği ve beni çok takdir edecektir yapısı var

  • diğer dosyaları
  • [content_types] thumbnail.png.

    DÜZENLEME 2:

    Bir dosyanın uzantısı 'xps' olduğunda küçük resmi başardınız.

  • cevap

    0

    OPC formatıyla ilgili bir şey yoktur. Windows, her dosya uzantısı için simge çizmenin kendi yoludur. Belirli bir dosya uzantısı için çizilen belirli bir simgeye sahip olmak için, IThumbnailProvider arabirimini uygulayan ve kaydettiren bir dll oluşturmalısınız. Daha fazla bilgi here.

    0

    Zip dosyaları için xps-IThumbnailProvider'ı kullanabilirsiniz, kendi yazıcınızı yazmaya gerek yok !!!

    zip dosyası için Küçük Resim Ekle:

    Dosyalar BOM sahip olmamalıdır !!!

    Windows Registry Editor Version 5.00 
    
    [HKEY_CURRENT_USER\Software\Classes\.frax\shellex\{BB2E617C-0920-11d1-9A0B-00C04FC2D6C1}] 
    @="{44121072-A222-48f2-A58A-6D9AD51EBBE9}" 
    
    [HKEY_CURRENT_USER\Software\Classes\.frax\shellex\{e357fccd-a995-4576-b01f-234630154e96}] 
    @="{44121072-A222-48f2-A58A-6D9AD51EBBE9}" 
    
    [HKEY_CURRENT_USER\Software\Classes\.frax\shellex\PropertyHandler] 
    @="{45670FA8-ED97-4F44-BC93-305082590BFB}" 
    
    : Eğer

    Public WriteOnly Property Thumbnail As Image 
         Set(value As Image) 
          If value IsNot Nothing Then 
           Dim relsdir = Me.ZipArchivWriter.CreateEntry("_rels/", CompressionLevel.NoCompression) 
           Using rels = Me.ZipArchivWriter.CreateEntry("_rels/.rels", CompressionLevel.Fastest).Open 
            Using w As New StreamWriter(rels, FXENCODING) 
             w.WriteLine(XMLSTART) 
             w.WriteLine("<Relationships xmlns=""http://schemas.openxmlformats.org/package/2006/relationships"">") 
             w.WriteLine("<Relationship Target=""thumbnail.png"" Id=""R1"" Type=""http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail"" />") 
             w.WriteLine("</Relationships>") 
            End Using 
           End Using 
           Using ct = Me.ZipArchivWriter.CreateEntry("[Content_Types].xml", CompressionLevel.Fastest).Open 
            Using w As New StreamWriter(ct, FXENCODING) 
             w.WriteLine(XMLSTART) 
             w.WriteLine("<Types xmlns=""http://schemas.openxmlformats.org/package/2006/content-types"">") 
             w.WriteLine("<Default Extension=""rels"" ContentType=""application/vnd.openxmlformats-package.relationships+xml"" />") 
             w.WriteLine("<Default Extension=""PNG"" ContentType=""image/png"" />") 
             w.WriteLine("</Types>") 
            End Using 
           End Using 
           Using tn = Me.ZipArchivWriter.CreateEntry(FXTHUMBNAIL, CompressionLevel.NoCompression).Open 
            value.Save(tn, ImageFormat.Png) 
           End Using 
          End If 
         End Set 
        End Property 
    

    .xps için yeniden adlandırın Sonra kayıt (ClassesRoot veya CurrentUser) için dosya uzantısını eklerseniz dosyanızın kadar

    deneyin minik resmi görüntüler

    Bu Hepsi ...

    İlgili konular