Results 1 to 7 of 7

Thread: Saving rich text and word docs in Access db

  1. #1

    Thread Starter
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629

    Saving rich text and word docs in Access db

    Is this possible ?
    Anyone done it or know about a tutorial ?

    peet

  2. #2
    Frenzied Member zuperman's Avatar
    Join Date
    Dec 2000
    Location
    Portugal
    Posts
    1,033
    you can save the contents of a word doc or a richtext into a memo field in Access database...
    Help keep this forum clean: Remember to mark your thread as resolved · Search before you post · Remember to rate posts that help

    VS2010: Visual Studio 2010 Keybinding Posters
    · Service Pack 1
    Tools: GhostDoc - automatically generates XML documentation comments
    · NuGet package Manager · PowerCommands IDE extensions
    Source Control: ankhsvn - integration for SVN
    · Windows Shell Extension for Subversion

    Development Laptop: Intel Core i5 430M 2.26 GHz @ 2.53 GHz
    · 4096 MB, DDR3 PC3-8500F (533 MHz), Kingston · ATI Mobility Radeon HD 5470 · 15.6 @ 16:9, 1366x768 pixel, HD LED LCD

    I follow:
    JoelOnSoftware - A weblog by Joel Spolsky, a programmer working in New York City, about software and software companies
    ScottGu's Blog - Scott Guthrie works for Microsoft as the Product Manager of the .NET Framework
    Portugal-a-Programar - Portuguese Developers Community
    .NET Rocks! - is a weekly Internet audio talk show for .NET Developers.

    Programming Languages:
    C#
    · VB.NET · JAVA · PHP · Javascript
    Other:
    XML
    · HTML · CSS · JQuery · SQL



    *** Proudly Portuguese ***

  3. #3

    Thread Starter
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    hi there zuperman,
    by content you mean the text only ?

    peet

  4. #4
    Frenzied Member zuperman's Avatar
    Join Date
    Dec 2000
    Location
    Portugal
    Posts
    1,033
    yep, u can store the text inside a memo field of a Access database...
    Help keep this forum clean: Remember to mark your thread as resolved · Search before you post · Remember to rate posts that help

    VS2010: Visual Studio 2010 Keybinding Posters
    · Service Pack 1
    Tools: GhostDoc - automatically generates XML documentation comments
    · NuGet package Manager · PowerCommands IDE extensions
    Source Control: ankhsvn - integration for SVN
    · Windows Shell Extension for Subversion

    Development Laptop: Intel Core i5 430M 2.26 GHz @ 2.53 GHz
    · 4096 MB, DDR3 PC3-8500F (533 MHz), Kingston · ATI Mobility Radeon HD 5470 · 15.6 @ 16:9, 1366x768 pixel, HD LED LCD

    I follow:
    JoelOnSoftware - A weblog by Joel Spolsky, a programmer working in New York City, about software and software companies
    ScottGu's Blog - Scott Guthrie works for Microsoft as the Product Manager of the .NET Framework
    Portugal-a-Programar - Portuguese Developers Community
    .NET Rocks! - is a weekly Internet audio talk show for .NET Developers.

    Programming Languages:
    C#
    · VB.NET · JAVA · PHP · Javascript
    Other:
    XML
    · HTML · CSS · JQuery · SQL



    *** Proudly Portuguese ***

  5. #5

    Thread Starter
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    ok, but what I want to do is save it all, both text and formatting... I'v seen this done in an application a long time ago, and I know the application used Acces database. And I'm pretty sure they used VB3.0 to develop it...

    Any Ideas ?

  6. #6
    ATommasi
    Guest
    You need a field defined as OLEObject and use the 2 functions below

    Example of use:

    ' Places file into database
    setBLOB myRecordSet, "FileField", "c:\FileToAdd.rtf"

    ' Save file to disk
    getBLOB myRecordSet, "FileField", "c:\FileToSaveto.rtf"
    VB Code:
    1. Public Sub getBLOB(RS As ADODB.Recordset, Field As String, Des As String)
    2.     Dim lngFieldSize As Long
    3.     Dim fileBytes() As Byte
    4.     Dim intFileHandle As Integer
    5.  
    6.     intFileHandle = FreeFile
    7.    
    8.     lngFieldSize = RS(Field).ActualSize
    9.     If lngFieldSize > 0 Then
    10.         fileBytes = RS(Field).GetChunk(lngFieldSize)
    11.         Open Des For Binary As intFileHandle
    12.             Put intFileHandle, , fileBytes
    13.         Close intFileHandle
    14.     End If
    15. End Sub
    16.  
    17. Public Sub setBLOB(RS As ADODB.Recordset, Field As String, Source As String)
    18.     Dim fileBytes() As Byte
    19.     Dim intFileHandle As Integer
    20.  
    21.     intFileHandle = FreeFile
    22.  
    23.     Open Source For Binary As intFileHandle
    24.         fileBytes = InputB(LOF(intFileHandle) - 1, intFileHandle)
    25.         RS(Field).AppendChunk fileBytes
    26.     Close intFileHandle
    27. End Sub

  7. #7

    Thread Starter
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    ahhh... (this is not an aha as if I understood all that )

    Thanks ATommasi !

    I'll get right to it and test the code.

    If u'r ever in Bergen, Norway, a beer will be waiting for you at the "Zacharias bryggen" (If you know the prices of beer in Norway you understand that I really appreciate your help!)

    Thanks again.

    peet

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width