• vipulpahwa
  • NEWBIE
  • 0 Points
  • Member since 2012
  • Personal DE

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 5
    Replies

I am trying to create a professional PDF document using standard APEX and HTML properties to create my content.

I am facing issue with the word-wrap property of CSS as it is misbehaving.

 

Let me explain

I am trying to display the contents of a field in a table (around 7 columns) and render it as pdf. Regardless of what I try, i cannot get the word-wrap to break the word so that the text does not go beyond the container.

 

Here is the code

<table class="tableStyle" >
<thead>
<tr>
<th width="5%" style="color:#FFFFFF;" align="center"><div id="inner">#</div></th>
<th width="30%" style="color:#FFFFFF;"><div id="inner">Field</div></th>
<th width="15%" style="color:#FFFFFF;"><div id="inner">Type</div></th>
<th width="30%" style="color:#FFFFFF;"><div id="inner">Values</div></th>
<th width="10%" style="color:#FFFFFF;"><div id="inner">Default Value</div></th>
<th width="10%" style="color:#FFFFFF;" align="center"><div id="inner">Track History</div></th>
</tr>
</thead>
<tbody>
<apex:repeat value="{!customObject.fields}" var="field">
<tr>
<td width="5%" align="center"><div id="inner">{!FLOOR(count)}</div></td>
<td width="30%"><div id="inner">{!field.label} ({!field.fullName})</div></td>
<td width="15%"><div id="inner">{!field.type}</div></td>
<td width="30%">
<div id="inner">
<apex:repeat value="{!field.values}" var="value">
{!value}<BR/>
</apex:repeat>
</div>
</td>
<td width="10%"><div id="inner">{!field.defaultValue}</div></td>
<td width="10%" align="center">
<div id="inner">
<apex:image value="{!URLFOR($Resource.DesignDocument, IF(field.trackHistory, 'images/checkbox/checkbox_checked.gif', 'images/checkbox/checkbox_unchecked.gif'))}"/>
</div>
</td>
<apex:variable var="count" value="{!count+ 1}"/>
</tr>
</apex:repeat>
</tbody>
</table>

 

and here is the css
table.tableStyle {
width: 100%;
border-collapse: collapse;
background-color: white;
cellpadding:0.5em;
table-layout: fixed;
}
#inner {
border-width: 0em;
margin: 0em;
word-wrap: break-word;
overflow: inherit;
}
td, tr, th{
font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 0.9em;
color:#000000;
align: left;
vertical-align: top;
word-wrap: break-word;
overflow:hidden;
}

 

Here is the kicker -
When I render this table in visualforce as pdf, the content overflows and gets clipped (due to overflow:hidden) if i dont specify the overflow:hidden property, it spills over in the next <td> block

 

But when i take the renderas pdf away from the page, the content wraps properly. Could you tell me how to resolve this issue?

Requirement: To create a professional looking dynamic pdf with Headers, Footers Table of Contents, etc. The page needs to be dynamic enough to display multiple sets of records, classified into categories (Won Opportunities, Lost Opportunities, Active Opportunities etc. in a tabular format spanning multiple pages due to the number of records.). 

 

What I have managed so far is that using this I have managed to insert repeating Headers and Footers and using the css page-break-before property I have managed to insert page breaks where appropriate.

 

Where I am struggling is to generate a dynamic Table of Contents with indented headers (hyperlinks) and page numbers.

 

Has anyone come across such requirement? Any help will be much appreciated.

 

Cheers

Vipul

Requirement: To create a professional looking dynamic pdf with Headers, Footers Table of Contents, etc. The page needs to be dynamic enough to display multiple sets of records, classified into categories (Won Opportunities, Lost Opportunities, Active Opportunities etc. in a tabular format spanning multiple pages due to the number of records.). 

 

What I have managed so far is that using this I have managed to insert repeating Headers and Footers and using the css page-break-before property I have managed to insert page breaks where appropriate.

 

Where I am struggling is to generate a dynamic Table of Contents with indented headers (hyperlinks) and page numbers.

 

Has anyone come across such requirement? Any help will be much appreciated.

 

Cheers

Vipul

Hello All,

 

I am programming something which requires a lot of data to be kept in memory for the VF page. And, I am keeping that data in Map.

 

A button from the page causes this Map to be re-initiated, i.e., to be re-filled. 

 

Now, when I fill the map the first time, it eats up 90% of my heap space. And, to fill it next time, I have to empty it first.., or force it to be garbage collected. 

 

Here is what I have tried :

 

System.debug('Heap Size 0.1: ' + Limits.getHeapSize() + ' , ' + Limits.getLimitHeapSize()); MainMap = new Map<ID, List<MyClass>>(); System.debug('Heap Size 0.2: ' + Limits.getHeapSize() + ' , ' + Limits.getLimitHeapSize()); MainMap = null; System.debug('Heap Size 0.3: ' + Limits.getHeapSize() + ' , ' + Limits.getLimitHeapSize()); MainMap = new Map<ID, List<MyClass>>(); System.debug('Heap Size 0.4: ' + Limits.getHeapSize() + ' , ' + Limits.getLimitHeapSize());

 

And, here is the output it produces:

 

 

Heap Size 0.1: 937950 , 1000000 Heap Size 0.2: 929766 , 1000000 Heap Size 0.3: 929758 , 1000000 Heap Size 0.4: 929766 , 1000000

 

 

 

  As you can see, the heap size is not getting reduced at all, which means I cannot fill the collection again !!

 

Any pointers or ideas on how I should force this Map to be garbage collected / free up some memory ?

 

Help would be greatly appreciated !!

 

     


 

  • July 01, 2009
  • Like
  • 1
Hi

I was trying to pass data between pages using the controller which failed. Is this possible every time I redirect I loose the state of the controller.

I have two pages with the same controller can I keep the data in the controller when I move from one page to the other sharing the data betweent he pages.

Regards

Vivek


Message Edited by Vivek Viswanath on 07-22-2008 10:50 AM

Message Edited by Vivek Viswanath on 07-22-2008 10:51 AM
Say I have page A which uses controller X, and page B controller Y. I want some continuity between the pages so that some variables in X are passed to Y when the user clicks a link in page A to visit page B.

I've implemented this with commandLink. The action method in X which transitions to page B includes a bunch of code that copies the relevant state variables into the request parameters. Example:

public PageReference goPageB() {

  PageReference ref = Page.pageB;

  ref.getParameters().put('p1', p1);

  ref.getParameters().put('p2', p2);

  ref.setRedirect(true);

  return ref;

}

This works fine. But I'm wondering if there's a better way. I'd rather pass the variables in a POST, or in a shared session object that both pages reference.