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
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 asteriskCode: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]"
It just a basic table and never a complete worksheet representation , if you have more a complex work upload a workbook.
hope that helps




Reply With Quote
Bookmarks