Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Divs printing in different position

Status
Not open for further replies.

JasonNevin

Programmer
May 26, 2005
29
GB
I am trying to use a repeater to print a multiple form and map data to the form. The form itself is stored as a gif and I'm trying to map to sections on the graphic so that my database fields print in boxes, etc. I have managed to achieve this as far as viewing the data on the screen but when I print the screen my data items print in completely different places. I'd be grateful for any advice on how to fix this or on an alternative way of achieving what I'm trying to do.

<%@ Page Language="vb" AutoEventWireup="false" codebehind="WorkSheet.aspx.vb" Inherits="BulkManager.WorkSheet"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WorkSheet</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content=" name="vs_targetSchema">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:repeater id="rptWorksheet" runat="server">
<ItemTemplate>
<div id="Worksheet" style="LEFT: 0px ; POSITION: relative; TOP: 0px;" >
<img src='bulk002ver3change1.gif' width = '650' height = '900'>
</div>
<div id="Date" style="LEFT: 105 px ; POSITION: relative; TOP: -885px; PAGE-BREAK-AFTER: always">
<font style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: Verdana ">
<%# databinder.eval(Container.dataitem, "Today")%>
</font>
</div>
<div id="SampleNo" style="LEFT: 300px; POSITION: relative; TOP: -897px">
<font style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: Verdana ">
<%# databinder.eval(Container.dataitem, "SampleNo")%>
</font>
</div>
<div id="CompanyName" style="LEFT: 480px; POSITION: relative; TOP: -909px">
<font style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: Verdana ">
<%# databinder.eval(Container.dataitem, "CompanyName")%>
</font>
</div>
<div id="UserName" style="LEFT: 105 px; POSITION: relative; TOP: -895px">
<font style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: Verdana ">
<%# databinder.eval(Container.dataitem, "UserName")%>
</font>
</div>
<div id="BulkNo" style="LEFT: 300px; POSITION: relative; TOP: -907px">
<font style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: Verdana ">
<%# databinder.eval(Container.dataitem, "BulkNo")%>
</font>
</div>
<div id="ClientSampleNo" style="LEFT: 480px; POSITION: relative; TOP: -918px">
<font style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: Verdana ">
<%# databinder.eval(Container.dataitem, "ClientSampleNo")%>
</font>
</div>
<div id="Material" style="LEFT: 10px; POSITION: relative; TOP: -896px">
<font style="FONT-SIZE: 7pt; COLOR: black; FONT-FAMILY: Verdana ">
<%# databinder.eval(Container.dataitem, "Material")%>
</font>
</div>
</ItemTemplate>
</asp:repeater></form>
</body>
</HTML>
 
Rather than using absolute positioning, I'd use relative positioning. You can specify a different CSS stylesheet that will automatically be used for printing as well so you can position everything differently if you need to. For more info, see the HTML forum (forum215).


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
ca8msm

Excuse my ignorance but am I not using relative positioning?
 
Sorry, I saw the TOP and LEFT attributes and assumed it was absolute (as Visual Studio tends to absolutely position elements).

The second part of my statement still stands though (i.e. use a seperate CSS file and set the media tag to "print"). You should probably move yopur inline CSS out to a seperate stylesheet and remove the outdated FONT tags as well but this will probably be pointed out to you in the HTML forum.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top