PRB: bindNewElements() of DhTable Changes to "" in Cell


The non-breaking spaces ( ) in a table's cells are removed from the
cells after binding to the table.


When a DhTable object is bound through a call to setBoundElements(), all
non-breaking spaces ( ) are converted to empty strings "".


To workaround this issue, you can bind to the DhTable using findElement()
instead of using setBoundElements(). For example, if you had a DhTable
named "table" you could do the following:

table = (DhTable)findElement("table");


This behavior is by design.


Steps to Reproduce Behavior

  1. Create a default Code-Behind HTML project in Visual J++ 6.0 as
    1. From the File menu, click New Project.
    2. Click the New tab in the New Project dialog box.
    3. Click Web Pages from Visual J++ Projects.
    4. Click Code-Behind HTML.
    5. Click Open to create the project.
  2. Modify as follows:
    import*;import*;import*;public class Class1 extends DhDocument{   public Class1()   {      initForm();   }   private void initForm()   {   }   protected void onDocumentLoad(Object sender, Event e)   {      DhTable t;      t = new DhTable();      t.setBindID("table");      this.setBoundElements(new DhElement[] { t });// Workaround: comment out the above 3 lines and uncomment the// following://    t = (DhTable)findElement("table");//    t.setBackColor(Color.RED);      DhCell cell=(DhCell)findElement("cell");      addText("Contents of DhCell is '"+cell.getText()+"'");   }}
  3. Modify page1.html as follows:
    <HTML><BODY><hr><OBJECT classid=""     height=0 width=0 ... VIEWASTEXT><PARAM NAME=__CODECLASS VALUE=Class1><PARAM NAME=CABBASE VALUE=Project1.CAB></OBJECT><!-- Insert HTML here --><TABLE align=center border=1 cellPadding=1 cellSpacing=1 width=75% id=table>  <TR><TD id=cell>&#xa0;*</TD><TD>&#xa0;</TD><TD>&#xa0;</TD></TR>  <TR><TD>&#xa0;</TD><TD>&#xa0;</TD><TD>&#xa0;</TD></TR></TABLE></BODY></HTML>
  4. Run the project.
RESULT: The Web page contains a table with one cell containing a "*". The
text "Contents of DhCell is '*'". Notice there is no space before the


For the latest Knowledge Base articles and other support information on
Visual J++ and the SDK for Java, see the following pages on the Microsoft
Technical Support site:
(c) Microsoft Corporation 1998, All Rights Reserved. Contributions by Derek
Jamison, Microsoft Corporation.

Id. de artículo: 197568 - Última revisión: 02/14/2017 - Revisión: 1

Microsoft Visual J++ 6.0 Edición estándar, Microsoft Software Development Kit for Java 3.1