Solution to JLabel Vertical Alignment Issue

I spent the last hour messing with all the alignment properties on a JLabel. None seemed to get rid of the small gap above the text in the JLabel. So here is what does work:
JLabel label = new JLabel();
label.setBorder(BorderFactory.createEmptyBorder(-2, 0, 0, 0));
You can make the negative number higher to move the text further up.
Hopefully this saves someone else some time.
Dan

I spent the last hour messing with all the alignment properties on a JLabel. None seemed to get rid of the small gap above the text in the JLabel. So here is what does work:
JLabel label = new JLabel();
label.setBorder(BorderFactory.createEmptyBorder(-2, 0, 0, 0));
You can make the negative number higher to move the text further up.
Hopefully this saves someone else some time.
Dan

Similar Messages

  • Vertical Alignment issue in Safari

    I have an issue in Safari displaying content of a table cell as if it's middle aligned and not vertically aligned. It works fine in IE and FF, but not in Safari.
    I am using a basic CSS setting for the table cell with vertical-align=top. I have also put in in the td tag valign=top and still have the problem where the content is middle aligned and not top aligned.
    Has anyone seen something like this and know what I can do to get it to work?

    Do you have a sample or a screenshot that illustrates this?
    Check out the Safari Developer's forum for more help; this is mainly used by people who are Users of Safari vs. Web Developers (who should know the difference between browsers).

  • Vertical Alignment Issue

    I have a problem. I've browsed through existing solutions and
    haven't found anything that works for me.
    I am working on a site that has lots of nested tables. The
    navigation bar and some other text are in a column on the left (in
    a nested table) and the page content is in a table on the right (in
    a nested table). However, the image and text in the left column
    continue to migrate down whenever I add too much content in the
    right column.
    This happens only on page where the height of the content in
    the right column exceeds the height of the content in the left.
    ALL properties for all tables have the vertical alignment set
    to "top" not to "default". Any help would be greatly appreciated. I
    am attaching the code for my style.css file.
    The page in question is located at
    http://www.ssc.coop/science/news.html.
    Thank you in advance ... Amy
    Text

    Yes. I stand corrected. Thanks Murray.
    valign="top" is the correct HTML syntax. valign:top is some
    invalid hybrid
    of HTML & CSS. Regardless, it can't/won't/doesn't work.
    Walt
    "Murray *ACE*" <[email protected]> wrote
    in message
    news:[email protected]...
    > Actually valign:top is nothing. But it's certainly
    invalid!
    >
    > --
    > Murray --- ICQ 71997575
    > Adobe Community Expert
    > (If you *MUST* email me, don't LAUGH when you do so!)
    > ==================
    >
    http://www.dreamweavermx-templates.com
    - Template Triage!
    >
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    >
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    >
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    > ==================
    >
    >
    > "Walt F. Schaefer" <[email protected]> wrote
    in message
    > news:[email protected]...
    >>> valign: top;
    >>
    >> This is invalid CSS. It is HTML. Yu can't use HTML
    code in CSS. Change it
    >> to vertical-align: top;
    >>
    >> Walt
    >>
    >> "AGrover" <[email protected]> wrote
    in message
    >> news:[email protected]...
    >>>I have a problem. I've browsed through existing
    solutions and haven't
    >>>found
    >>> anything that works for me.
    >>>
    >>> I am working on a site that has lots of nested
    tables. The navigation
    >>> bar and
    >>> some other text are in a column on the left (in
    a nested table) and the
    >>> page
    >>> content is in a table on the right (in a nested
    table). However, the
    >>> image and
    >>> text in the left column continue to migrate down
    whenever I add too much
    >>> content in the right column.
    >>>
    >>> This happens only on page where the height of
    the content in the right
    >>> column
    >>> exceeds the height of the content in the left.
    >>>
    >>> ALL properties for all tables have the vertical
    alignment set to "top"
    >>> not to
    >>> "default". Any help would be greatly
    appreciated. I am attaching the
    >>> code for
    >>> my style.css file.
    >>>
    >>> The page in question is located at
    >>>
    http://www.ssc.coop/science/news.html.
    >>>
    >>> Thank you in advance ... Amy
    >>>
    >>>
    Text
    >>>
    >>> td {text-align: left;
    >>> valign: top;
    >>> font-family:tahoma;
    >>> font-size:10px;
    >>> color:#919191;
    >>> line-height:13px;}
    >>>
    >>> a {text-decoration:underline;
    >>> color:#298EAA;}
    >>>
    >>> body { margin:0px;padding:0px;}
    >>>
    >>> ul {margin:0; padding:0; list-style:none}
    >>> li {background:url(images/a.gif) center left
    no-repeat; margin:0 0 0
    >>> 0px;
    >>> padding:0 0 0 10px; line-height:16px }
    >>> li a { color:#54A5BB}
    >>>
    >>> .usa span { color:#298EAA}
    >>> .copy { color:#BABABA}
    >>> .copy a { color:#BABABA; text-decoration:none}
    >>> .copy a:hover {text-decoration:underline}
    >>> .education { color:#757575}
    >>> .team span { color:#54A5BB}
    >>> .privacy a { color:#54A5BB}
    >>>
    >>> .white {color:#ffffff; text-decoration:none}
    >>> .arrow_right { margin-right:6px;}
    >>>
    >>> .form { width:205px;
    >>> height:29px;
    >>> font-family:tahoma;
    >>> font-size:10px;
    >>> border-style: solid;
    >>> border-width: 1px;
    >>> border-color:#9E9E9E;
    >>> background-color:#ffffff;
    >>> color:#919191;
    >>> margin-left:0px;
    >>> margin-right:0px;
    >>> padding-top:8px;
    >>> padding-left:8px;}
    >>>
    >>> .textarea { width:190px;
    >>> height:119px;
    >>> font-family:tahoma;
    >>> font-size:10px;
    >>> border-style: solid;
    >>> border-width: 1px;
    >>> border-color:#9E9E9E;
    >>> background-color:#ffffff;
    >>> color:#919191;
    >>> margin-left:0px;
    >>> margin-right:0px;
    >>> padding-top:8px;
    >>> padding-left:8px;}
    >>>
    >>> a:hover{text-decoration:none;}
    >>> .a:hover{text-decoration:underline;}
    >>>
    >>
    >>
    >
    >

  • Standalone multi-line JLabel vertical alignment

    I have a JLabel subclass that I am using an a Servlet environment, with iText to create a PDF. When I set the vertical alignment to CENTER, the vertical spacing is not correct and the label runs off the bottom of its allocated area. The JLabel is not attached to any Container, it is simply a standalone JLabel with no parent.
    I've done a little digging/debugging and it appears that the View (a javax.swing.plaf.basic.BasicHTML$Renderer) is returning the height of a single line of text from getPreferredSpan(View.Y_AXIS), even though when painted, the label spans several lines. This causes SwingUtilities.layoutCompoundLabel to calculate the wrong starting Y value for the text area.
    When I use this JLabel subclass in a GUI/Swing program that I have, added to a JPanel, it works correctly.
    Looking for any clues or suggestions.

    Partial answer:
    I noticed that in the GUI environment, that the paint() method was being called twice. The first time through, the height of the text was calculated as I described above in the standalone environment - for only a single line of text. The second time through, it calculated the height correctly.
    I changed my subclass to call super.paint(g) (with a dummy Graphics) if there is no parent. This "fixes" the problem in the standalone environment.
    I theorise that it takes 2 passes through the size calculations in the View - once to set the width and again to set the height. Any further insights are welcome.

  • Keynote on Ipad warning: custom and mixed lists may look different... bulleted list have bullet vertical alignment "issues" any fixes?

    Help.
    I am working on a high-end Keynote presentation. It was originally a poerpoint file, that I opened in keynote. So far so good. I applied keynote themes, and used bullets etc, looks great on the mac. Move it to the ipad, and the top bullet looks fine, all 1st level bullets below it have a higher vertical alignment, which no longer in alignment with the text. What am I doing to cause this? all spacing etc, is exactly the same.
    anybody know a tip or trick to keep this from happening?

    I answered my own question... with many, many tests.
    I FINALLY figured out what the common feature was, that was causing the misalignment of the bullets.
    Line spacing.
    If you apply line spacing BEFORE a paragraph, it misaligns the bullets... which is WHY it wasn't happening to the 1st bullet in each text box, but only those following....
    In the final test I changed the line spacing attribute to AFTER a paragraph, and VOILA! no more misaligned bullets.
    It's definitely a bug in the software, since either way it looks fine on the mac, and is only a problem on the iPad.
    hope that saves someone else some valuable time!!!

  • Table content vertical alignment issue in Dreamweaver cs4

    Hello,
    I can't figure this one out. I made a sample file (code below) to debug my problem.
    I have a table inside a table. Both have no cell padding or spacing and top alignment, yet, the text appears to the top but there's a gap between the top of the cell and the text. Has anyone had that problem ? Same issue when I place a picture in the table, even if the pictute is 100px X 100px and the table size the same, there still is a gab between the picture and the top of the table ???
    Many thanks,
    <body>
    <table width="500" border="0" cellspacing="0">
      <tr>
        <td valign="top" bgcolor="#00FF00">Test</td>
      </tr>
      <tr>
        <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td valign="top"><p>This text is in a table inside the first table</p>
              <p>Both tables have no cellspacing and no cellpadding yet the text is not entirely aligned to the top of the cell/table !</p></td>
          </tr>
        </table></td>
      </tr>
    </table>
    </body>

    See this live example of a basic table.
    http://alt-web.com/DEMOS/basic-table.html
    Content in table cells is effected by heading and paragraph styles.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb

  • Losing table vertical alignment when converting ditamap to book

    FrameMaker Version: 12.0.4.445 (latest, part of TCS5)
    I have a structured project, where several XML files have been arranged into a ditamap.
    For one of the XML files, I have a table, where I need to set Cell Vertical Alignment of the cells to MIDDLE.
    So using Paragraph Designer > Table Cell, I change the entries from Top to Middle (The defaults were Top).
    With the ditamap pane selected, I then go File menu >> Save Ditamap As
    I save the ditamap as "Book 12.0 with fm components (*.book)" file type.
    In the resulting book, the XML files are now .FM files.
    However, at this point, when I open the .FM file that has the table, the cell styles have reverted to TOP.
    I've searched high-and-low for a similar issue. This is looking like a bug to me, but can someone confirm?
    Thanks

    (Perhaps the moderator should move this to the FrameMaker Integration discussion (under RoboHelp).
    I've determined the correct settings for my purposes, that being vertical alignment in a FM-to-RH integration project. I originally thought it was specifically a FrameMaker issue, though the solution also involves settings in RoboHelp. Here are my findings:
    1. For the selected FM table, note its Table Tag in the Table Designer (e.g., FormatA). This will be used later.
    2. If there is table Entry > Image element, then select the Image element, and set its placement attribute = inline.
    Though inline is supposed to be the default, I found it necessary to state explicitly in order to control alignment of image within a RH table cell.
    3. Moving on from FM, in the CSS file that you are using with your RH project, suppose that you have defined your table as follows. Note that I'm using "CenterMiddle" as the title.
    table.CenterMiddle {
      width: 100% ! important ;  /* This forces the RH table to autofit the window */
      text-align: Center;
      font-family: "Adobe Garamond Pro";
      border-left-style: Solid;
      border-left-width: 1px;
      border-left-color: #000000;
      border-right-style: Solid;
      border-right-width: 1px;
      border-right-color: #000000;
      border-top-style: Solid;
      border-top-width: 1px;
      border-top-color: #000000;
      border-bottom-style: Solid;
      border-bottom-width: 1px;
      border-bottom-color: #000000;
    .CenterMiddle td {
      vertical-align: middle ! important ;  /* This forces the individual cells to align vertically */
      border-color: #000000;
      border-style: solid;
      border-width: 1px;
    4. Go to the RH project to which the FM project is linked.
    5. Go File menu > Project Settings.
    6. In the FrameMaker Document group, click Edit.
    7. Under FrameMaker Settings, locate the Table style that you noted in step (1), and set it to the name of your table from (3).
    At this point, you can update all the FM components in your RH project, and compile the RH project to get the desired results. In my case, I needed both text and images in the table cells to have vertical alignment = middle.

  • Vertically align text

    Hi
    Is it possible to vertically align text within a frame?
    Thanks

    Wade_Zimmerman wrote:
    I really do not think there is a reason to do this but if the OP has a good reason or wants to tell us why they need this we might be abe tooffer them a better way.
    I searched for a solution to this myself and missed this thread before i posted my own thread. but I find it odd how when this is asked for people are asked to give a good reason to use the bounding box, or like here told that there is no reason to need this. Well here is my current situation.
    I have a project that has 500+ peices. I am using data sets and variables.xml  to create them all quickly.
    Each one consists of a 1 of  three logos and 1 of 500+ lines of text and all the lines of text are  different lengths
    Now the problem I am having is getting the  text to wrap properly instead of running off the art board. This was easilly solved by using a text box. Now I am faced with a new issue, One line texts are all sitting really high on the artwork.
    So I would like to center all text vertically inside the box

  • Can Grow Vertical Alignment Error in Embedded Report View, but not in .PDF

    Hello,
    I have seen postings about this issue before, but have yet to find a solution. 
    I am using Visual Studio 2008 w/ the basic version of Crystal Reports that is included.
    I have a simple report that displays results of a stored procedure as rows across the report.  One field can be of variable length, anywhere from 0 to 100 characters.  Usually it's something reasonable (less than 40 chars), and so I have only given it so much width in the report.  For when it is longer than that, I turned the "Can Grow" property ON, and set the Maximum Number of Lines property to 0. 
    When the report displays embedded in my Web Form, and this field's data is wider than the space I have allowed, it breaks the data down into multiple lines of the same correct width, as you'd expect, but those lines end up displaced vertically upward several rows, and print directly on top of other data from the above rows, make the report unreadable in that area (and quite ugly overall!).
    If I export this report to a .PDF, it displays perfectly, without the vertical displacement error.
    Anyone know what the official work is on this?  Is there a fix or is this a bug?
    If there is no fix, does anyone know how to direct the report to the .PDF file viewer, so the embedded report remains invisible (and thus hides the ugly error), but the user has the .PDF version to see?  My client ultimately wants to export the report to .PDF, which I have already coded, but it does not open the .PDF Viewer, just saves the report to disk.  However, if I use the Crystal built-in Export button, it first displays a pop-up asking which format to export to, then if .PDF is chosen and okay is clicked, the pop-up switches to contain the .PDF Viewer, and opens the report.  In my user-defined export code, the .PDF is correctly created, but I am missing the step on how to open the .PDF Viewer.
    Any ideas?

    Thanks for the responses.
    Jonathan, moving the field in question to its own details section (details B) did not fix the issue.  The field in question is moved slightly down as its in a new details section with sits slightly lower than details A, but when it has to be broken up into multiple lines, the same issue arises, the field text is displaced vertically upward and sits on top of other data.
    Ludek, I wanted to send the report to a .PDF Viewer in a new browser, and keep the original browser intact.  I'm using code very similar to yours.  To launch the new broswer I added this code to the Page_Load of my main browser:
    btnViewReport.Attributes.Add("onclick", "window.open(Page.aspx', """", """", 'height=200,width=400')")
    When the button is clicked the report is exported, and the new browser opens Page.aspx.
    I use this code in Page_Load of Page.aspx:
            Dim webClient As System.Net.WebClient = New System.Net.WebClient()
            Dim buffer As Byte() = webClient.DownloadData("C:\Reports\Report.pdf")
            If Not buffer.Length.Equals(0) Then
                Response.ContentType = "application/pdf"
                Response.AddHeader("content-length", buffer.Length.ToString())
                Response.BinaryWrite(buffer)
            End If
    Any other ideas on the original vertical displacement issue when using Can Grow, I'd still appreciate it.
    Thanks,
    Scott
    Edited by: Scott Deltorto on Sep 23, 2008 10:15 PM

  • Form Alignment issue in table: Custom submit button

    Yesterday as I was putting together a "check availability"
    form within a horizontal table, I ran into difficulties getting the
    form to vertically align in the middle, it kept aligning to the
    top. I was able to correct the problem using the following CSS:
    <style>
    form {
    display:inline;
    </style>
    Now this morning I was switching the generic "submit" button
    with a custom gif button using this code within the form:
    <input type="image" name="submit" src="image.jpg"
    width="110" height="20">
    This worked fine, but every part of the form is aligning to
    the middle correctly except the custom button which is sticking to
    the top. I'm completely lost on how to resolve this issue. If
    anyone has any information on how I can fix the button to align
    with the rest of the form I would greatly appreciate your help. I
    am a beginner at adjusting code.
    Thank you so very much!

    Hello Ram,
    > No custom coding.
    The current forum is for developers. That's why I'd recommend asking non-programming questions in the
    Using SharePoint Designer, InfoPath and Other Customizations forum instead.

  • How to vertically align Prompts on the same line in OBIEE

    Can we vertically align "Product Line (Owned)" and "Product Line(Not Owned)" in this Prompt on same vertical line?
    so that "Product Line(Owned)" can start from the same vertical line where "Product Line(Not Owned)" starts
    we tried few options by adding a text element in dashboard and playing with td.GFPFilter
    but couldn't find a solution to it.
    we were looking into this thread
    Dashboard Prompt Alignment
    Currently we have it like this, alignment is not same due to "Not Owned" text being longer than "Owned" text
    "Product Pillar (Owned)"--------------"Product Line (Owned)"---------------------"Product (Owned)"
    "Product Pillar (Not Owned)"--------------"Product Line (Not Owned)"---------------"Product (Not Owned)"
    we want to have it like this,
    "Product Pillar (Owned)"--------------"Product Line (Owned)"-------------"Product (Owned)"
    "Product Pillar (Not Owned)"---------"Product Line (Not Owned)"--------"Product (Not Owned)"

    Hi Rupak,
    I just tried it and it the solution is pretty easy. Just add a text-box to your dashboard holding the following:
    <style>td.GFPFilter {width: 200px}</style>You need to check "Contains HTML markup"
    Regards,
    Stijn

  • Vertically align middle input text in a text box

    I'm creating Flash-based software that has text boxes where users write in the answers to questions. I want the text that the user types to be vertically aligned to the middle of the text box, so that even if the response is two or three lines, it is still centered in the box.
    It doesn't appear that I can accomplish this through the properties window in Flash. Am I missing something? Or is it possible to set the properties of the text box with actionscript, and would that allow me to vertically align the text?
    Thanks!

    You're not the first to ask this, but if you got an answer of how to do it, you'd likely be the first.  I don't think it is possible since there doesn't appear to be any sort of top margin property available for TextFields.  You might be able to fake something like that though if you think about it... like using the changed event of a textfield to reposition it vertically in a pseudo border/bkgnd.
    If you do come up with a solution, you should share it here... as I said, you're not the first to ask.

  • More alignment issues

    hi,
    I'm hardly an expert - but I have made great strides because of helpful people who throw me a hint.
    my site: www.kirarmerica.com
    I still have JUST a FEW alignment issues.  I like to have everything centered, so now I am just down to my spec sheets.
    I know that they might not be configured ALL the same, but I am hoping I can change a few things
    please look at Kira America | Products
    click on any spec sheet and you will see that the headers menu and sometimes the footer stays centered, but the spec info jumps to the  left of the page.
    I've found the correct .css to edit.  but I cant quite figure out how to align the columns vertically on the page.
    for example if I put a margin on #right_column it put it in the right spot, but then the rest of the content jumps all over the page.
    any hints would be helpful!

    These changes will center content in white area
    #container h1, #container h2, #container h3, #container h4, #container h5, #container h6 {
        border-bottom: 1px solid #DEDACB;
        padding-bottom: 8px;
        text-align: center;
    .excel214 {
        border: medium none;
        color: #000000;
        font-family: Calibri,sans-serif;
        font-size: 11pt;
        font-style: normal;
        font-weight: 400;
        margin-left: auto;
        margin-right: auto;
        padding-left: 1px;
        padding-right: 1px;
        padding-top: 1px;
        text-decoration: none;
        vertical-align: bottom;
        white-space: nowrap;

  • VERTICAL ALIGNMENT ON WORD TABLE IS MISS.

    Hello everybody,
    Can somebody clear my mind? I did the code below, and this generates a beautiful and clean table on word 2010. The problem is that the instruction “.Rows.Height = 8” and 
    “.Cells.VerticalAlignment = Word.WdCellVerticalAlignment.wdCellAlignVerticalCenter” seems
     not work, besides, when I try to adjust the rows height and vertical alignment by myself, after routine generates the table of course, Word don´t allow me to do these adjustment by hand.
    The property “.Rows.Height = 8” seems to be working, because when I change to “.Rows.Height = 25” the rows height really goes to it, also, there is no problem with horizontal alignment, this is work very fine.
    Working with VS 2012 and Word 2010.
    Tried everything, no result….
    Thank you.
    Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
    Dim WA As New Word.Application
    Dim WD As Word.Document
    Dim WS As Word.Selection
    Dim model_address, mes_extenso, texto, texto_ref, pic_address As String
    model_address = Application.StartupPath & "\GTMS_MDL.docx"
    pic_address = Application.StartupPath & "\PIC\TABELA01.png"
    WD = WA.Documents.Open(model_address, [ReadOnly]:=True)
    WS = WA.Selection
    Dim WT1 As Word.Table
    Dim WR1 As Word.Range
    Dim lin_wt1, lin_wt2, lin_wt3 As Integer
    lin_wt1 = 3
    WT1 = WD.Tables.Add(WA.Selection.Range, lin_wt1 + 2, 5)
    With WT1.Range
    .ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter
    .Cells.VerticalAlignment = Word.WdCellVerticalAlignment.wdCellAlignVerticalBottom
    .Rows.Shading.BackgroundPatternColor = Word.WdColor.wdColorAqua
    .Rows(1).Shading.BackgroundPatternColor = Word.WdColor.wdColorBlueGray
    .Rows.Borders.OutsideLineStyle = Word.WdLineStyle.wdLineStyleSingle
    .Columns.Borders.InsideLineStyle = Word.WdLineStyle.wdLineStyleSingle
    .Font.Bold = True
    .Font.ColorIndex = Word.WdColorIndex.wdWhite
    .Rows.Height = 8
    .Columns(1).Width = 30
    .Columns(2).Width = 350
    .Columns(3).Width = 40
    .Columns(4).Width = 50
    .Columns(5).Width = 50
    .Font.Size = 7
    End With
    WT1.Range.Text = ""
    WT1.Cell(1, 1).Range.Text = "ITEM"
    WT1.Cell(1, 2).Range.Text = "DESCRIÇÃO"
    WT1.Cell(1, 3).Range.Text = "QTD."
    WT1.Cell(1, 4).Range.Text = "UNIT."
    WT1.Cell(1, 5).Range.Text = "SUBTOTAL"
    For i = 0 To lin_wt1
    WT1.Cell(i + 1, 2).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft
    Next
    For i = 0 To lin_wt1 - 1
    WT1.Cell(i + 2, 1).Range.Text = i + 1
    WT1.Cell(i + 2, 2).Range.Text = DGV1.Rows(i).Cells(2).Value
    WT1.Cell(i + 2, 3).Range.Text = DGV1.Rows(i).Cells(3).Value
    WT1.Cell(i + 2, 4).Range.Text = DGV1.Rows(i).Cells(4).Value
    WT1.Rows(i + 2).Range.Font.ColorIndex = Word.WdColorIndex.wdBlack
    WT1.Rows(i + 2).Range.Font.Bold = False
    Next
    WT1.Cell(lin_wt1 + 2, 1).Merge(WT1.Cell(lin_wt1 + 2, 2))
    WT1.Cell(lin_wt1 + 2, 2).Merge(WT1.Cell(lin_wt1 + 2, 4))
    WT1.Cell(lin_wt1 + 2, 1).Range.Text = "TOTAL GERAL"
    WT1.Rows(lin_wt1 + 2).Range.Font.ColorIndex = Word.WdColorIndex.wdDarkRed
    WT1.Rows(lin_wt1 + 2).Range.Font.Size = 10
    WT1.Cell(lin_wt1 + 2, 1).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft
    WT1.Cell(lin_wt1 + 2, 2).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter
    WT1.Cell(lin_wt1 + 2, 2).Range.Text = FormatCurrency(12560, 2)
    WA.Visible = True
    WA = Nothing
    WD = Nothing
    WS = Nothing
    End Sub

    Hi,
    >>The problem is that the instruction “.Rows.Height = 8” and 
    “.Cells.VerticalAlignment = Word.WdCellVerticalAlignment.wdCellAlignVerticalCenter” seems
     not work, besides, when I try to adjust the rows height and vertical alignment by myself, after routine generates the table of course, Word don´t allow me to do these adjustment by hand.
    The property “.Rows.Height = 8” seems to be working, because when I change to “.Rows.Height = 25” the rows height really goes to it, also, there is no problem with horizontal alignment, this is work very fine<<
    I am not able to understand the issue exactly. Can you set the height for the rows using Rows.Height? I made a quick test using VBA based on the code above, it works well for me. And I can also adjust by hand after run the code.
    >> “.Cells.VerticalAlignment = Word.WdCellVerticalAlignment.wdCellAlignVerticalCenter” seems
     not work<<
    What effect did you want to achieve? Based on the code samlpe you were setting the verical alignment to bottom however the description are center. Both center and bottom for the vertical alignment works well for me.
    I would suggest that you test the code using a new document to see whether the issue is realtive to the specific document. Here is the test code in VBA for your reference:
    Sub test()
    Dim WA As New Word.Application
    WA.Visible = True
    Dim WD As Word.Document
    Dim WS As Word.Selection
    Dim model_address, mes_extenso, texto, texto_ref, pic_address As String
    'model_address = Application.StartupPath & "\GTMS_MDL.docx"
    model_address = "C:\doc1.docx"
    'pic_address = Word.Application.StartupPath & "\PIC\TABELA01.png"
    Set WD = WA.Documents.Open(model_address, ReadOnly:=True)
    Set WS = WA.Selection
    Dim WT1 As Word.Table
    Dim WR1 As Word.Range
    Dim lin_wt1, lin_wt2, lin_wt3 As Integer
    lin_wt1 = 3
    Set WT1 = WD.Tables.Add(WA.Selection.Range, lin_wt1 + 2, 5)
    With WT1.Range
    .ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter
    .Cells.VerticalAlignment = Word.WdCellVerticalAlignment.wdCellAlignVerticalCenter
    .Rows.Shading.BackgroundPatternColor = Word.WdColor.wdColorAqua
    .Rows(1).Shading.BackgroundPatternColor = Word.WdColor.wdColorBlueGray
    .Rows.Borders.OutsideLineStyle = Word.WdLineStyle.wdLineStyleSingle
    .Columns.Borders.InsideLineStyle = Word.WdLineStyle.wdLineStyleSingle
    .Font.Bold = True
    .Font.ColorIndex = Word.WdColorIndex.wdWhite
    .Rows.Height = 8
    .Columns(1).Width = 30
    .Columns(2).Width = 350
    .Columns(3).Width = 40
    .Columns(4).Width = 50
    .Columns(5).Width = 50
    .Font.Size = 7
    End With
    WT1.Range.Text = ""
    WT1.Cell(1, 1).Range.Text = "ITEM"
    WT1.Cell(1, 2).Range.Text = "DESCRI??O"
    WT1.Cell(1, 3).Range.Text = "QTD."
    WT1.Cell(1, 4).Range.Text = "UNIT."
    WT1.Cell(1, 5).Range.Text = "SUBTOTAL"
    For i = 0 To lin_wt1
    WT1.Cell(i + 1, 2).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft
    Next
    For i = 0 To lin_wt1 - 1
    WT1.Cell(i + 2, 1).Range.Text = i + 1
    WT1.Cell(i + 2, 2).Range.Text = "a" 'DGV1.Rows(i).Cells(2).Value
    WT1.Cell(i + 2, 3).Range.Text = "b" 'DGV1.Rows(i).Cells(3).Value
    WT1.Cell(i + 2, 4).Range.Text = "c" 'DGV1.Rows(i).Cells(4).Value
    WT1.Rows(i + 2).Range.Font.ColorIndex = Word.WdColorIndex.wdBlack
    WT1.Rows(i + 2).Range.Font.Bold = False
    Next
    WT1.Cell(lin_wt1 + 2, 1).Merge WT1.Cell(lin_wt1 + 2, 2)
    WT1.Cell(lin_wt1 + 2, 2).Merge WT1.Cell(lin_wt1 + 2, 4)
    WT1.Cell(lin_wt1 + 2, 1).Range.Text = "TOTAL GERAL"
    WT1.Rows(lin_wt1 + 2).Range.Font.ColorIndex = Word.WdColorIndex.wdDarkRed
    WT1.Rows(lin_wt1 + 2).Range.Font.Size = 10
    WT1.Cell(lin_wt1 + 2, 1).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft
    WT1.Cell(lin_wt1 + 2, 2).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter
    WT1.Cell(lin_wt1 + 2, 2).Range.Text = FormatCurrency(12560, 2)
    WA.Visible = True
    Set WA = Nothing
    Set WD = Nothing
    Set WS = Nothing
    End Sub
    Hope it is helpful.
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Vertical-align problem in css?

    Hi everyone
    This is my id selector code within the css file of my air app which i'm using in a div:
        border-color:black;
        border-style:solid;
        border-width:1px;
        height:100%;
        width:15%;
        float:left;
        vertical-align:baseline;
    I have no idea why the verticle-align is not working as it would do in safari, which uses the same rendering as air??
    Can anyone help with this PLEASE! It has been giving me serious heart ache!!!!! and can't find anything on it anywhere!!!!!
    Thank you all in advance
    IrishAIRMax

    Here is a better description of my problem and also the solution finally!!!. I haven't tried the solution yet --- waiting for my thinkpad to crazy with the scrolling!
    http://blog.jonschneider.com/2008/03/workaround-thinkpad-gets-into-always.html
    Spoke to soon --- just had the scrolling problem and pressed the middle button the problem with the scrolling got resolved!
    Message Edited by utharay on 02-08-2009 07:57 AM
    Message Edited by utharay on 02-08-2009 07:58 AM

Maybe you are looking for