Monday, 22 September 2008

Headers and Footers referring to report items

If you have used Microsoft Reporting Services and have tried to make a header or footer more complex that just plain text and images, you have probably at one point received the error: "The Value expression for the textbox 'Item_Desc' refers to a field. Fields cannot be used in page headers or footers." What a pain in the jacksie.
You'll be pleased to know there is a workaround although currently it is limited. What you need to do is put the field you want to refer to into the report body and set the visibility-hidden to true (assuming you do not want to show it in the body). In the textbox for the header or footer, refer to the hidden textbox value rather than the field itself: =ReportItems("Item_DescTextBox").Value This is permitted for some reason, although it is annoying. Presumably it is related to the header trying to render outside of the report body but who knows.
There is a gotcha though, you might find in some reports, that the item appears in some headers/footers but not others. Quite simply, if the hidden textbox is not visible on the page that the header and footer is on, it cannot be referred to which is total garbage but that is how it is. If this happens, you need to try and put the field into a part of the report body that is repeated on every page. For instance, if you have some intro text, a table and then some summary text, put the hidden field inside one of the repeating table rows and try and make sure part of this table is on the first and last pages, this way, the header and footer will always be able to refer to it.

Tuesday, 16 September 2008

Poor quality images in generated PDF

PDF has become the de-facto standard interchange format for documents. It seems to handle lots of types of data and seems surprisingly to be one of the few media that are consistent across computer platforms.
I was using it at work the other day after realising that one of our corporate brochures had a very poor quality copy of our logo on it. I checked the original Word doc and the image looked fine.
I ran it through CutePDF just to make sure this was the correct original and sure enough the image came out bad - looking like 20 dots per inch!! The original image was a few thousand pixels in width and height and was scaled down to about 50mm x 15mm so resolution wasn't an issue.
I then installed Adobe Acrobat (which fortunately we already had so I didn't have to shell out £300 for the standard version!!). I tried converting the file from Acrobat and then after realising there was a bug, fixed it so that I got the buttons inside Word and converted it from there, both with the menu item and also using the Adobe PDF printer driver. None of this worked, the image still looked bad. Interestingly I tried several formats and they came out different but equally terrible. I then switched off compression and downsampling and got a massive PDF (2 pages 45Mb) but still a rubbish logo.
Almost at wits end, I put in copies of all the logo formats I had and generated the PDF again. The ONLY one that looked OK was the Windows Meta File (WMF) type which is probably because it is vector unlike the other bitmapped images.
So I found a workaround but no help on the net (other than lots of people saying how rubbish the Acrobat application is). I am very disappointed. Even MS Word is cheaper than Acrobat and has much more functionality. In fact you can probably get Office basic for the same price!! Acrobat gave me nothing useful and obviously couldn't handle what were very basic images. It managed to convert other jpegs so if my images weren't in the correct format, something should have complained.
Bloatware Bah!

Monday, 8 September 2008

Patch Tuesday

I notice this morning that Microsoft are touting 4 critical security patches next Tuesday in their monthly update patch. Apparently these affect all versions of windows, including vista: http://www.theregister.co.uk/2008/09/05/ms_patch_tuesday_pre_alert/

Every time I read these things I get angry but not surprised. Remember every time MS have released a new version of windows, they always tout the "more secure" marketing jibe. This seems to make sense except that not long after they release these things, another load of patches come out which undermine the fundamental idea of security. To be fair, these patches might be related to applications rather than the Operating System but for goodness sake Microsoft, these problems have been occuring for years and you still haven't fixed your security model. You've released Vista on the promise of more security, and it certainly adds a lot in the annoyance department with all the "are you sure" messages, but still haven't thought about the underlying problems. Quite simply, it should be impossible on most configurations for a user visiting a web site to do anything dubious such as deleting or reading files off the hard disk. Why doesn't Internet Explorer simply not permit it for any site in any scenario? How many people really do need to access files from the browser, certainly not most home users.

The other problem is that saying "more secure" is not a lie. Having 10 known vulnerabilities instead of its predecessor's 100 does make it "more secure", until the next 1000 are found anyway!

I used to really like Windows. XP isn't bad but over time it has become bloated, slow and generally annoying. Linux on the other hand has got better and better and now presents me with little hassle for the fact it is fast, robust, secure and free!

Please go and buy it.