table border thickness with UseVariableBorders set to true - pdf

I’m using iTextSharp 5.5.7 and PdfPTable.
I have a question about table border.
I need to customize the border (like the color or size for example). So I set UseVariableBorders to true.
In iText in action book, I saw that setting this method to true will make “the cell looks slightly bigger than the others : the thickness of the border is distributed equally inside and outside the cell dimensions”. This makes the outside border of the table looks smaller than the inside.
Other point, if you set for a cell, the border of the next cell will appear (in the example, the cell in the second column is merged vertically with a colspan of 2 and the last row cell is merged horizontally with a colspan of 2):
Is there a good way to avoid that? (table event?)

Related

Adding a background image to a particular cell

I tried to insert the background image using following code:
Pic = "C://Picture/Logo1"
Activesheet.SetBackgroundPicture Pic
This inserts the picture to full sheet but I want to add it to particular cell or a range of cells. Please help
As far as I know excel doesn't support appending the image to a cell (with or without VBA).
The background of a single cell supports colors/gradients/fill-patters, but not the pictures.
It is possible however, to "place" the picture (shape) object with the same width and height right above the cell and make it locked and move around together with the cell if somebody attempts to resize cell widths. I personally wouldn't go that way, too much to code and too much risk of breaking the structure.

Excel Macro: Command buttons overlap the shape in worksheet

I have 2 command buttons, different height and width of the cells that need to be inserted every time and a fixed shape. Sometimes when the height and width are smaller, it tend to overlap with the command buttons. What should I do? I need the command buttons to be there. I tried to put certain range, it works but when the width and height of the cells gets bigger, it moves further away. Any idea? I'm thinking of maybe putting the range cells for the command buttons to stay as Range A and B as default. Will that work? But I don't know how to do it.
Set the top, left properties on the shape, then irrespective of the size it should always start at the same place.
Dim Fred as shape
Set Fred = activesheet.shapes.addshape(type,left,top etc,)
Fred.placement= xlfreefloating

excel rowheight - a bug here?

Excel seems to work with the row heights in the following (il)logic:
If you refer to a single cell and your cell is defined "Wrap Text" and the row height is "Autofit":
When you enter more characters than what can fit to the cell width the row in the cell is changed automatically and in the end, when you press "Enter", the row height is expanded so that the whole text is visible.
If you refer to combined cells and your cell combination is "Wrap text" and "Autofit":
When you enter more characters than what can fit to the combined cells' width the row is NOT changed automatically and after "Enter" the row height is NOT adjusted to show the whole text.
I think this is not logical.
What would be the trick to get excel to automatically adjust the row height also in the case of "Wrap Text" combined cells? Any VBA solutions? (Basically you could, maybe, count how many line changes the combined cell has and adjust the rows.height property accordingly but...

Reinstate Excel chart default resizing behaviour using VBA

I am looking for a way to reinstate the default/native resizing behaviour of a chart in Excel 2010 once it has been disabled (e.g. by manipulating the chart with VBA).
Now I haven't been able to find anything anywhere about the behaviour I have in mind, so I am going to assume that it needs detailed explanation.
Input and select random numerical data into 4-5 cells in Excel, and insert a new Clustered Columns chart. You need to see a the chart's plot area. Now select the chart, and get the PlotArea.Top value with the following line
ActiveChart.PlotArea.Top
If you haven't touched the chart, this should return a value of 7. Now use one of the chart's handlebars to resize the chart vertically, and use the same command line again.
activechart.plotarea.top
Notice how the value returned is still 7. Now set this property to 7 in VBA.
ActiveChart.PlotArea.Top = 7
Again, grab one of the handlebars, resize the chart vertically and get the .top property again using:
ActiveChart.PlotArea.Top
Notice how the value has now changed. It will be either smaller or greater than 7 depending on whetehr you decreased or increased the size of the chart.
Once any element of a chart has been moved either manually or with VBA code, it loses this "absolute position" property and begins moving inside the ChartArea whenever the chart is resized. While some elements can be reset using .SetElement, this does not work for the Plot Area. For example, the following command lines do not reinstate the behaviour I am describing.
ActiveChart.SetElement msoElementPlotAreaNone
ActiveChart.SetElement msoElementPlotAreaShow
I do a lot of automated resizing of charts with VBA, and having the plot area move around by itself makes it a lot harder to predict the effect of resizing the chart and leads to inconstant results.
So back to the question: does anyone know of a way to reinstate this default behaviour, either for the entire chart, or at least specifically for the PlotArea?
Thanks in advance to anyone who may help!
Vincent
I ran into this when I manually resized the plot area and then when the legend is moved it did not resize the plot area at all.
I had tried to save my chart as a template (right click save as template in Excel 2013) but this still had the plot area manually set.
Therefore I would recommend keeping the auto-size behavior before saving a template, since the only way I know to re-set the chart auto-sizing behavior after it has been manually modified is to use a macro
Here is the macro I used to reinstate the auto-sizing behavior
Sub Macro1()
'
' this selects the chart based on the chart name
ActiveSheet.ChartObjects("Chart 4").Activate
' this selects the plot area
ActiveChart.PlotArea.Select
' this clears any custom formatting such as borders or fill colors
ActiveChart.PlotArea.ClearFormats
' this resets the auto-sizing behavior after plot area manually re-sized
ActiveChart.PlotArea.Position = xlChartElementPositionAutomatic
End Sub
References
Why plot area does not expand after clearing series legend?
Excel Chart Plot Area Auto Size - ExcelBanter

Using BIRT, how can I ensure that the background colour in a row is the same height in each cell in the row?

I have a BIRT report that I have set up to use conditional formatting so that the colour of the row alternates between grey and white. It works as expected except for the fact that the grey colour in a field with a string extends slightly below where the grey extends in a field with an integer. In other words, if the grey background is 1 inch high with an integer, it is 1.1 inch high with a string. I cannot see any differences in any of the margin or padding settings so I am not sure what would be causing this small issue.
It is easy to be confused with styling, because we can set style properties on rows, cells or data fields within cells.
As you describe this issue, i think you have not applied this conditional formatting on rows, but on cells or data fields.
When a BIRT table is selected in the outline view of Eclipse designer, we need to click on the left to select the whole row, and then define a conditional formatting. Thus, physically we can't have height differences between cells (at least in html format) because the style is applied on a "div" container.