[AccessD] HTML Align

John Colby jwcolby at gmail.com
Sat Jul 23 09:09:04 CDT 2022


BTW this is what I get when I actually do a center in the text box and read
it back

<div align=center><font face=Arial color=blue><strong>Subscribed :
False</strong></font></div>

I had hoped I could just use an align tag in a similar manner to italics.


On Sat, Jul 23, 2022 at 9:56 AM John Colby <jwcolby at gmail.com> wrote:

> lol, I screwed that up.  I moved a variable I shouldn't have in the
> function and now it doesn't compile.  If you are interested in the function
> itself use the following, which does compile.
>
> Function FormatString()
>     mstrFormatted = mstrToFormat
>     Dim mstrFormattedClosingFontTag As String
>     Const strInteriorQuotes As String = """"
>     If mintStatus > 0 Then
>         mstrFormatted = "<Font Color=" & strInteriorQuotes &
> HTMLColour(mintStatus) & strInteriorQuotes & ">" & mstrFormatted
>         mstrFormattedClosingFontTag = mstrFormattedClosingFontTag &
> "</Font>"
>     Else
>         mstrFormatted = "<Font Color=" & strInteriorQuotes & mstrColor &
> strInteriorQuotes & ">" & mstrFormatted
>         mstrFormattedClosingFontTag = mstrFormattedClosingFontTag &
> "</Font>"
>     End If
>     '
>     'Get the three font pieces grouped
>     '
>     If mstrFace <> "" Then
>         mstrFormatted = "<Font Face=" & strInteriorQuotes & mstrFace &
> strInteriorQuotes & ">" & mstrFormatted
>         mstrFormattedClosingFontTag = mstrFormattedClosingFontTag &
> "</Font>"
>     End If
>     If mintSize <> -1 Then
>         mstrFormatted = "<Font Size=" & CStr(mintSize) & ">" &
> mstrFormatted
>         mstrFormattedClosingFontTag = mstrFormattedClosingFontTag &
> "</Font>"
>     End If
>     mstrFormatted = mstrFormatted & mstrFormattedClosingFontTag
>     If mblnBold Then
>         mstrFormatted = "<b>" & mstrFormatted & "</b>"
>     End If
>     If mblnItalics Then
>         mstrFormatted = "<i>" & mstrFormatted & "</i>"
>     End If
>     If mblnUnderline Then
>         mstrFormatted = "<u>" & mstrFormatted & "</u>"
>     End If
>     Select Case mintAlign
>         Case enumAlign.eCenter
>             mstrFormatted = "<align=" & strInteriorQuotes & "center" &
> strInteriorQuotes & ">" & mstrFormatted & "</align>"
>         Case enumAlign.eLeft
>             mstrFormatted = "<align=" & strInteriorQuotes & "left" &
> strInteriorQuotes & ">" & mstrFormatted & "</align>"
>         Case enumAlign.eRight
>             mstrFormatted = "<align=" & strInteriorQuotes & "right>" &
> mstrFormatted & "</align>"
>     End Select
>     If mblnCRLF Then
>         mstrFormatted = mstrFormatted & "<br>"
>     End If
>
> End Function
>
> On Sat, Jul 23, 2022 at 9:48 AM John Colby <jwcolby at gmail.com> wrote:
>
>> I am attempting to get my HTML Formatter to do alignment tags.  It ain't
>> werkin.  Of course I'm ignorant of HTML in general so that isn't
>> surprising.  Can it be as simple as I thought and/or can anyone help me get
>> it done?
>>
>> I'm essentially trying to directly encase the string to be formatted with
>> something like
>>
>> mstrFormatted = "<align=" & strInteriorQuotes & "center" &
>> strInteriorQuotes & ">" & mstrFormatted & "</align>"
>>
>> What I get displayed is:
>>
>> <align="left">Subscribed : False</align>
>> Where the string includes the tags at either end instead of the tags
>> being interpreted and performing the align.
>>
>> The full function is as follows:
>>
>> Function FormatString()
>>     mstrFormatted = mstrToFormat
>>     Const strInteriorQuotes As String = """"
>>     If mintStatus > 0 Then
>>         mstrFormatted = "<Font Color=" & strInteriorQuotes &
>> HTMLColour(mintStatus) & strInteriorQuotes & ">" & mstrFormatted
>>         mstrFormattedClosingFontTag = mstrFormattedClosingFontTag &
>> "</Font>"
>>     Else
>>         mstrFormatted = "<Font Color=" & strInteriorQuotes & mstrColor &
>> strInteriorQuotes & ">" & mstrFormatted
>>         mstrFormattedClosingFontTag = mstrFormattedClosingFontTag &
>> "</Font>"
>>     End If
>>     '
>>     'Get the three font pieces grouped
>>     '
>>     Dim mstrFormattedClosingFontTag As String
>>     '
>>     If mstrFace <> "" Then
>>         mstrFormatted = "<Font Face=" & strInteriorQuotes & mstrFace &
>> strInteriorQuotes & ">" & mstrFormatted
>>         mstrFormattedClosingFontTag = mstrFormattedClosingFontTag &
>> "</Font>"
>>     End If
>>     If mintSize <> -1 Then
>>         mstrFormatted = "<Font Size=" & CStr(mintSize) & ">" &
>> mstrFormatted
>>         mstrFormattedClosingFontTag = mstrFormattedClosingFontTag &
>> "</Font>"
>>     End If
>>     mstrFormatted = mstrFormatted & mstrFormattedClosingFontTag
>>     If mblnBold Then
>>         mstrFormatted = "<b>" & mstrFormatted & "</b>"
>>     End If
>>     If mblnItalics Then
>>         mstrFormatted = "<i>" & mstrFormatted & "</i>"
>>     End If
>>     If mblnUnderline Then
>>         mstrFormatted = "<u>" & mstrFormatted & "</u>"
>>     End If
>>     Select Case mintAlign
>>         Case enumAlign.eCenter
>>             mstrFormatted = "<align=" & strInteriorQuotes & "center" &
>> strInteriorQuotes & ">" & mstrFormatted & "</align>"
>>         Case enumAlign.eLeft
>>             mstrFormatted = "<align=" & strInteriorQuotes & "left" &
>> strInteriorQuotes & ">" & mstrFormatted & "</align>"
>>         Case enumAlign.eRight
>>             mstrFormatted = "<align=" & strInteriorQuotes & "right" &
>> strInteriorQuotes & ">" & mstrFormatted & "</align>"
>>     End Select
>>     If mblnCRLF Then
>>         mstrFormatted = mstrFormatted & "<br>"
>>     End If
>>
>> End Function
>>
>> --
>> John W. Colby
>> Colby Consulting
>>
>
>
> --
> John W. Colby
> Colby Consulting
>


-- 
John W. Colby
Colby Consulting


More information about the AccessD mailing list