Results 1 to 10 of 62

Thread: BBCode Table

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Junior Member pike's Avatar
    Join Date
    Dec 2011
    Posts
    27
    Rep Power
    0
    Hello,
    The PHP code is executed by the Web server when a web page is accessed and the resulting output is written as HTML within the Web page.

    I just tried different PHPBB table properties to find which ones also worked with BBcode as the is little written about all there methods and properties.

    Your question is about excel cell string which split string with carriage return[s] and converting to BBcode via VBA.

    BBCode or Bulletin Board Code is a basic markup language used to format posts boards which is complied by HTML to covert to a basic table ect...

    The VBA BBcode generator does not account for carriage returns in a cell .. work around .. .do not use carriage return and then size the columns and rows height and width to the desired look. Converting excel cell height and width to BBcode table (Height and Width) is a best fit as different fonts have different character heights and widths. basic algorithm for fifteen or so character (few Spaces) is RoundUp(BB_Cells.ColumnWidth * 7.5, 0) you will never get an exact conversion match. It is linear but also needs a count of different character sizes. a x potential algorithm could be better guess for 15 to 25 chars

    Code:
     Set BB_Range = Selection
        BB_Code = "[table=" & """" & "class:thin_grid" & """" & "]" & vbNewLine
        BB_Code = BB_Code & "[tr][td][font=Wingdings]v[/font][/td]" & vbNewLine
        For Each BB_Cells In BB_Range.Rows(1).Cells
            strWidth = Application.WorksheetFunction.RoundUp(BB_Cells.ColumnWidth * 7.5, 0)
            BB_Code = BB_Code & "[td=" & """" & "bgcolor:#ECF0F0, align:center,width:" & strWidth & """" & "][B]" & Split(BB_Cells.Address, "$")(1) & "[/B][/td]" & vbNewLine
        Next BB_Cells
        BB_Code = BB_Code & "[/tr]"
    Also not all excel font styles are available in BBcode so I never tried added them into the routine .. but you could do it and if the font is not available use a default. you will notice in the code above the Windings font does not always get complied from a v to an asterisk

    It just a basic table and never a complete worksheet representation , if you have more a complex work upload a workbook.

    hope that helps
    Last edited by pike; 05-04-2016 at 12:20 PM.

Similar Threads

  1. test bbcode
    By pike in forum Test Area
    Replies: 3
    Last Post: 05-16-2016, 03:58 AM
  2. Excluding Records of one Table from the Other Table
    By Transformer in forum Tips, Tricks & Downloads (No Questions)
    Replies: 0
    Last Post: 05-17-2013, 12:32 AM

Posting Permissions

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