Home |
Search |
Today's Posts |
#16
![]()
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming
|
|||
|
|||
![]()
JLG
You could set the row heights in mm which is not OS font or resolution-dependent. Ole Erlandson has code for setting row and column dimensions in mm. http://www.erlandsendata.no/english/...vbawssetrowcol Gord Dibben Excel MVP On Sun, 9 Dec 2007 14:10:01 -0800, JLGWhiz wrote: Hi Rick, No intent to challenge or dispute your code. I was just pointing out that Excel is not conducive to precision measurement. I have noted that my settings are sometimes adusted, as an example, from 12.40 to 12.52 or some variation other than what I set. Of course if there is a way to get precision measurements to set, I would be interested in knowing how. "Rick Rothstein (MVP - VB)" wrote: According to Micorsoft, in the site listed below, 6 points equals 8 pixels. However, it seems to me that I read somewhere that Excel adjusts row height and columns width based on the font used and screen resolution settings. That means that if you expect to get a precision setting, forget it. http://office.microsoft.com/en-us/ex...517241033.aspx I have tested the code I posted with two different (in Windows only) DPI settings against several fonts at several different font sizes for each and for several different initial RowHeight settings and, in each test, it has always increased the height by the number of pixels I specified. Of course, that is not *proof* that it will always work for every combination of font, fontsize and row height, but I suspect that it will. Why? Well, font heights are **always** set to an exact number of pixels where they are displayed (you can't have a font in the Windows world display at a fractional pixel height on a monitor), so I'm thinking the point measurements you see for row heights are determined from the exact number of pixels a font at a given size occupies and not the other way around. That would mean the ultimate row height settings are set by pixels first and then translated back to points meaning calculation at the pixel level should convert back to the point level properly. You can sort of see this happening if you increase the spreadsheet's font size by one at a time and look at the resulting RowHeight that results. Here is the process being done for Arial FontSize Points Pixels ======================== 10 12.75 17 11 14.25 19 12 15.00 20 13 16.50 22 14 18.00 24 15 18.75 25 16 20.25 27 Notice that the pixels go up either 1 or 2 per fontsize increase of 1 and the the point size goes up either 0.75 or 1.5 in step with the pixel number increase. What I am pretty sure is happening is that the font is rounded to the nearest whole number of pixels for the give fontsize and then the point size equivalent for that number of pixels (for the DPI setting of the monitor) is then calculated and applied to the RowHeight property. I also think Excel is "fooling" us by reporting the fontsize in as whole numbers. In Windows, screen font sizes are usually floating point values 8.25, 10.75, etc. and these correspond to the pixel to points conversion for the exact number of pixel the fontsize occupies on the monitor. I believe Excel, like a lot of programs now-a-days, is reporting the printer's fontsize setting... the printer has a much higher pixel density per inch than the monitor and can support whole number point sizes more readily than the monitor can. Anyway, a lot of what I have discussed above comes from my first-hand experience when dealing with fonts in the compiled VB world (again, on the Windows operating system; I have no idea how all of this would translate to on a Mac). Rick |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
pixels | New Users to Excel | |||
Pixels are the new pies | Charts and Charting in Excel | |||
Size of column in pixels | Excel Discussion (Misc queries) | |||
copying rows where a result cell has a certain value or higher | Excel Discussion (Misc queries) | |||
some columns 30 characters 155 pixels others 310 pixels why | Excel Discussion (Misc queries) |