Picture Inline with Text

TriAdX

Registered User.
Local time
Today, 12:06
Joined
Aug 25, 2009
Messages
22
Ok please bare with me. I have looked and looked and no one can point me exactly where I need to be.
I was told to look up RTF and found something close:
Stephan Lebans code

but the problem with that method is that it stores the image in the database. It also adds a bunch of stuff to the data in the RTF field. I want to keep my data clean and clear and i need to store my images externally

I just want my Data cell to look something like:

"All of this great text is fine but i need a (!S) to help and if I dont get a (!S) then i will be (!F) and that will be no good."

and when I print my report it needs to show like:
"All of this great text is fine but i need a
smile.gif
to help and if I dont get a
smile.gif
then i will be
frown.gif
and that will be no good."

Obviously the (!S) and (!F) can be whatever characters but I can not store the whole image in each field.

I want to use an outside image. (so the database only stores my text content and my "code/symbol" to call the image path) I was hoping i could just use the vb code part of access to define my image paths and what "code/symbol" should be replaced by that image/image path.

I cant have the images stored in the database.

any help would be greatly appriciated.
 
Last edited:
maybe, you could outline what you need without the plentiful" :eek::confused::(:rolleyes:;):p "additions and give a clear indication of what your problem is so someone can assist.

ok.. I hardly over used the Smileys and they are perfect for my example.

Let me try to go more in depth with my needs.

I have a memo field in my table. This field contains text information. I need my report to display an image from a location i designate inline with my text. For example, if I have the following text in my memo field:

"(!W) Warning: This is a warning"

then when i view my report I want the (!W) to be replaced with an image that i designate (maybe in the VB?) and it should display like this:

":eek: Warning: This is a warning"

The image needs to apear within the text.

The only thing I can think of is to write a script in the VB that would search my Textbox data for any of my "keywords" and when displayed in the report, replace the text "keyword" with an image defined within the script.

the (!W) would be a key word.. I can use whatever text to define the "keyword", the text used doesnt matter to me. So if there is some sort of "Breakout" text then i would use that.

some psudo code would be

Where Memofield.Text contains '(!W)'
replace with 'c:\image\W.jpg'

or something along those lines

I basically just need to insert images along with my text and each row of data in my memo field will be different and contain different data.
 
Hi,

i was just pulling your leg about the smileys :p

im not sure you can mix images with text. in fact, im pretty sure you cant. i the best i would suggest is a field next to your memo field that will show the image then use Left() to get the first count of characters in your memo. then, you could use a select statement.

the image field can hold an image but it doesnt matter as you can change the picture with VBA to whatever you want so lets look at an example.

Folder to hold the images
C:\Program Files\My Custom App\Images\

image names
warning.png
attention.png
halt.png
smile.png
Default.png

MemoField
txtMyMemo

Image Field
imgImageToShow
( This would be an embedded image from the design tools )

Code:
Dim strImageChar As String
Dim strFullImagePath As String

'Set the folder path for images
strFullImagePath = "C:\Program Files\My Custom App\Images\"

 ' collect the first 4 chars from field and store "(!W)"
strImageChar = Left(me.txtMyMemo, 4 )

Select Case strImageChar
Case "(!A)"
Me.ImageToShow.Picture = strFullImagePath & "Attention.png"
Case "(!W)"
Me.ImageToShow.Picture = strFullImagePath & "warning.png"
Case "(!H)"
Me.ImageToShow.Picture = strFullImagePath & "Halt.png"
Case "(!G)"
Me.ImageToShow.Picture = strFullImagePath & "Smile.png"

Case Else
Me.ImageToShow.Picture = strFullImagePath & "Default.png"

End Select

im not sure what your first set of characters are you want to find but i would suggest non smiley as the character counts can be different in length thus creating you a problem. you should really make a list up that keeps the same amount of characters so your string will always return the correct find value.


Hope this helps and please let me know how you get on.


regs

Nigel
 
ehh sort of. The idea seem decent but its not quite what i need.

More examples.

I have a text box and here are 4 sample rows that would be loaded into that textbox:

Row1 "Altered creature (US) for (B) instead of it's normal energy."
Row2 "When (US) for energy you receive 1 unpreventable damage."
Row3 "(D): Target Creature gains Evasive (this creature can not be attacked) until end of turn."
Row4 "(US): Target Creature gets -1/-0 until end of turn. (B), (SD): Target Creature gets -0/-1 until end of turn"

now as you can see I have "images" in multiple different spots. My images are as follows:
(US)
(B)
(D)
(SD)

there is no method as to where they appear in the textbox so I cant just say... the first 4 chars are my "images"

Maybe some sort of scripts that finds how far into the text the "image" may be then creates an image box with the appropriate REAL image positioned over it some how?

Like I said the RTF that I found in my link was close.. but it was a custom control or something and it put extra coding in my memo field and also stored the image in the memo field.. I need the images to be stored externally.

Ideas?!
 
Code:
[SIZE=2]Private TargetPosition As Integer[/SIZE]
[SIZE=2] 
Private Sub FindText(ByVal start_at As Integer)
Dim pos As Integer
Dim target As String

    target = txtTarget.Text
    pos = InStr(start_at, txtBody.Text, target)
    If pos > 0 Then
        [COLOR=#008000]' We found it.[/COLOR]
        TargetPosition = pos
        txtBody.SelStart = TargetPosition - 1
        txtBody.SelLength = Len(target)
        txtBody.SetFocus
    Else
        [COLOR=#008000]' We did not find it.[/COLOR]
        MsgBox "Not found."
        txtBody.SetFocus
    End If
End Sub

[COLOR=#008000]' Find the text.[/COLOR]
Private Sub cmdFind_Click()
    FindText 1
End Sub

[COLOR=#008000]' Find the next occurrance of the text.[/COLOR]
Private Sub cmdFindNext_Click()
    FindText TargetPosition + 1
End Sub
[/SIZE]


I found this find and highlight script but I dont know how I would apply that to an image instead of just highlighting the found text... maybe some way to apply this sort of logic to find the "image" and the position in my text and then have the margin or Left of the image equal to the Number of chars X the amount of space a char takes?

er... issues i see: chars take up different amounts of space depending on the char and what happens when the text goes to the next line?
 
do you want to post your db or pm me for my email address? its hard to fix something blind. if you have code that "nearly" does what you want, then im sure we can get it to exactly what you want however, its much easier when you can see the whole scenario.

Nigel
 
I can post it.. but i dont really have it so that its close... I dont even know how to approach the concept I am looking for.

I will post it give me a min
 
www.forevertreasuredphotography.com/myspace/TriAdX.zip
here it is.

DB and template files so you can really see what I am trying to do.

Just extract it to your C: drive. It will create a folder called /TriAdX and /TriAdX/Templates

the images go in templates and without them you cant view the reports.

again.. I am trying to replace the (US) and (D) and stuff like that with images in the main Text box.

Ever see Magic The Gathering Cards?... I am trying to add the "Tap" symbol basically or the "Mana Symbol" to the text
 
Hi,

sorry if i seem a bit dumb here but i still dont get what youre trying to do. the images in the templates folder will never fit in the text box you have and even if you did, the text would be spaced that far apart, you wouldnt properly read what it was saying due to the size of the images. if you make the images smaller, you wont view the images properly.

the images look like cards with blank areas for text. is your intention to fill the card with text?

nigel
 
Your right, they are cards.

Print Preview the Report and you will see the cards data is populated.

If you go through some of the cards you will eventually see a card that has a (US) or a (D) or (SD)

I would want to replace the (US), (D), and (SD) with custom Icons. I dont have any of these images included in the file I sent but they would just be small icons that would fit inline with the text like a :D. See how the smiley fits inline with the text... thats kinda what I am looking for...

so on card # 1 (the first card on the report) in the text box, it says:

"Altered creature (US) for B instead of it's normal energy."


I want it to display in my report as:

"Altered creature :D for B instead of it's normal energy."

and on card #14 it says:

"(US): Abolish target (D) non-Black creature or non-Black relic."

I want it to show in the report as:

":D: Abolish target :mad: non-Black creature or non-Black relic."

of course the smileys only represent real jpgs that I need to have in the Templates folder.
 
esper-battlemage1.jpg


see how this Magic card has images in the textbox. the (W)(T): Prevent the next 2... and the (B)(T): Target creature gets...

I am looking for the same thing.


Other cards have symbols thoughout the text like:

thornscape_battlemage.jpg
 
Hi,

i see that now. to be honest, i dont think Access will do that for you. a RTF can combine an image as HTML sent over to an email but an email can handle that. i just dont think access fields can. The code you posted i have working and i can search for (!W) and i can find it in a string, change the value and move on to the next (!W) in the same field until i have found them all but thats as far as i am at the minute.


regs

nigel
 
of course, another way is to photoshop the text and images to one image and have your form field display the image if its only reading purposes without user updating.

Nigel
 
Yikes. I can't photoshop every card. If you check out the link I posted about the rtf and install his control ad check out his example ( the first one I think). You will see how he can put an image in with the text that could work using that rtf control format if I could just get rid of all the extra code it puts in your memo field and get it to use external images instead of embedding them.
 

Users who are viewing this thread

Back
Top Bottom