473,782 Members | 2,494 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Report stretching/reducing

Hello to all.

Ever had a problem when your print some reports in a printer other the
one you use more frequently, in which the report width span more tban
one page? I did, and didn't liked it.

But there's a simple way for automatically reducing the report size to
a size that prints well in the troubling printer. Here goes a sub that
receives the following parameters:

- repName : Report name;
- xFactor : Factor to be multiplied by the 'Left' and 'Width'
properties;
- yFactor : Factor to be multiplied by the 'Top' and 'Height'
properties;

So, 'StretchReport "Report1", 1.1, 0.95' stretches the height of
"Report1" by 10% and reduces it's width by 5%.

I hope that it will be useful to anyone. Please feel free to comment
the code and this article.
-- The Code -------------------------------------------------------------------

Option Compare Database
Option Explicit

Sub Demo()
Const kRepName = "EV - Registo de Visitas"
Const kXFact = -2.7
On Error Resume Next
DoCmd.Close acReport, kRepName, acSaveNo
On Error GoTo 0

StretchReport kRepName, kXFact

DoCmd.OpenRepor t kRepName, acViewPreview
End Sub
' Aplica um determinado factor ao tamanho e posição de todos os
controlos de um relatório.
' Argumentos:
' - 'repName': Nome do relatório;
' - 'xFactor': Factor a multiplicar pelas propriedades '.Left' e
'.Width' dos controlos;
' - 'yFactor': Factor a multiplicar pelas propriedades '.Top' e
'.Height' dos controlos;
' 'xFactor' e 'yFactor' devem ser a percentagem a esticar (se forem
positivos) ou a contraír
' (se forem negativos).
' Por exemplo, 'StretchReport "rep", 10, -5' estica a largura do
relatório 'rep' em 10% e
' contrai a sua altura em 5%.
' NOTA: O relatório é deixado aberto, com as alterações feitas por
guardar.
Sub StretchReport(r epName As String, ByVal xFactor As Single, Optional
ByVal yFactor As Single = 0)
DoCmd.OpenRepor t repName, acViewDesign
Dim rep As Report
Set rep = Reports(repName )
Dim xf As Double
xf = 1 + xFactor / 100
Dim yf As Double
yf = 1 + yFactor / 100

Dim ctrl As Control
For Each ctrl In rep.Controls
ctrl.Left = Round(ctrl.Left * xf)
ctrl.Width = Round(ctrl.Widt h * xf)
ctrl.Top = Round(ctrl.Top * yf)
ctrl.Height = Round(ctrl.Heig ht * yf)
Next
rep.Width = 0 ' Obrigar a assumir a largura mínima do relatório.
End Sub
Nov 13 '05 #1
0 1359

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4092
by: Martin | last post by:
Hi, I have an Access 97 report that mimics an official UK Covernment Customs document, with Page Headers and Footers presenting static data for each page (logos etc). The report is made up (typically) of several lines of detail data, with a few summary lines at the foot of these. I am (nearly) achieving the right "look and feel" by presenting the line items in the Report Detail section and the summary lines in the Report Footer BUT...
0
1378
by: Alfred Wallace | last post by:
Hello, I'm using CRAXDRT and AxCRVIEWER9Lib.AxCRViewer9 in a c# form to see a cystal report. I'm connected to oracle 9. database and my report is connected on several tables and show several fields (one is a blob (bitmap)). My form has a list (of IDVal) and the report. I update the report contents when the selected item of the list change.
4
1788
by: Arthur Dent | last post by:
Hello all... i have a really frsutrating problem here... This is only happening in IE (6 & 7b2), Mozilla and Netscape are both OK. I have a top-level table with a width of 760px, so it should be 760 minimum and stretching wider as needed to fit content (such as bound datagrids). In the top TR/TD, i have a header table which is width of 100%, and has three TD's. Each contains one image file, with the middle TD being set to width 100%. So...
11
1975
by: Ryan | last post by:
I am writing a VB (2005) program that will allow the user to fill out and print a form. The form input is stored in a database (SQL 2005) to be retrieved/viewed/printed later. The form is originally a Word Document, I also have this form as a PDF. Appearance and quality is critical for this form.. so what I thought I'd do is convert the form to a bitmap, use a picture object on my VB form and overlay textbox (no border) controls on top...
1
1338
by: derekdeben | last post by:
Hi, I created a report that groups on week ending dates and has a total for each date and a grand total for the month. However, The report is 13 pages long with many blank pages since I said "no" to visible detail. How do I change the report to print everything on one page. It should fit but the hidden detail is forcing multiple pages. Thanks in advance, Derek
2
1622
by: Matt800 | last post by:
Two little problems that are annoying me!; 1) I have created a report in access (based on a parameter query) which contains 18 fields (mainly dates - dd/mm/yyyy). There are too many fields to fit all the information accross one page, portrait OR landscape. I've tried cramming the fields in and reducing the text to size 7 but its still not working. Is there any way i can create a portrait, vertical report so the field names are listed on the...
1
3298
by: replyrpatil | last post by:
What I am trying to do: I need to print a compact access report (font 6 size) created using RTF2 program developed by Stephen Lebans to generate a TIF image of custom size (5.5 in x 2.0 in) Problem Recreation : Download attached RAR file (http://download.yousendit.com/627919383AFAA7E3 ) Steps 1) Install RTF2 program created by Lebans 2) Install ZAN Image Printer (Virtual Printer) 3) Create Custom Paper Size ----...
0
1188
by: shaiful | last post by:
Hi All, I have a problem with to show the data report. The massage is " Report width is larger than the paper width" However, i know it can be solve by reducing report width, but i want to make report width bit bigger. and how it will fit with paper size, i mean how it is possible to extend paper size of report? Thx advance
2
2775
by: NJonge01 | last post by:
Hi, I have a report that should conditionally show some objects on the Report Header. These are the lowest objects in that section and they're not always necessary depending on where I'm opening the report from. My code to conditionally set some objects to .Visible = False is working well. However, the Report Header is not "shrinking", it is just leaving the large empty space. Even if I try to conditionally change the height using...
0
9639
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10311
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10146
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10080
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9942
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5509
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4043
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3639
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.