• StrangeRoutines
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 9
    Replies

I recently had a problem/bug with PDF rendering for small caps. I figured I could simulate small caps by applying two different font sizes to the text line but to my surprise, when I tried it, I encountered another PDF rendering bug.

 

In this situation, the style sheet had some selectors with a comment on the same line as the selector. This was fine when displaying the VF page normally, but, when rendering in PDF, the selectors were not applied. When the comments were moved to their own lines, the PDF render then worked fine!

 

The involved page and style sheet are lengthy and fairly complex so I will post them only if somebody is actually interested in seeing them.

 

In summation, the rule is obvious. If you are rendering in PDF,  comments must be placed on their own lines in the style sheet. I would even be cautious about placing comments inside the style declaration (i.e. between the curly braces)!

I have a customer requirement to display a PDF document with various parts of it in "small caps". If I display the document as a regular VF page, its fine. However, when I add the renderAs="PDF" attribute, the small caps disappear. The document is complex with many styling changes and requires a separate style sheet. However, the problem is easy to demonstrate with a simple document, e.g.:

 

<apex:page sidebar="false" standardStyleSheets="false" showHeader="false">
<style type="text/css">
p {font-variant:small-caps;}
</style>
<p>This should be small caps.</p>
</apex:page>

 

The above works as expected.  However, add in the renderAs, and the small caps disappear!

 

I have tried everything. I've tried setting the body selector, I've tried spanning with a class or an id. I've used a separate style sheet, wrapped the text in an apex:outputText tag and then added style and/or styleclass attributes to the apex tag. I've tried specifying font families (which is a real shot in the dark since I've found no documentation on what fonts are available to SFDC's iText instances.)

 

Has anybody seen this before or have a solution or know if this a confirmed bug? [My OS is WinXP SP3 5.1.2600 (i.e. fully up to date) and my Adobe Reader is 8.2.5 (i.e. fully up to date)]

 

I can think of a workaround but for large docs, its ugly. You would change the required words to uppercase and use two fonts, one for trailing parts of words and a larger one for the leading character, where needed.

Is there any documentation anywhere that details what constitutes a valid identifier in APEX? For instance, when trying to compile an apex class, the compiler claims that x__x (two underscores) is an invalid identifier. Oddly, so is x___x (three underscores). As is using the name of a custom object prefixed by anything, like xxxMyObj__c where "MyObj__c" is the custom object.

 

Just curious...

(I am posting this here as I couldn't find a board for just the IDE)

When you create a new "Apex Component" with the IDE, it puts in this awful, long default value for the description that starts out "This is a generic template for Apex Component."  and then runs on and on. I know you can edit the metadata for the component you are creating, but is there a way to change the default value to something else (like maybe a blank) so I don't have to edit it for each new component I create?

I have a custom object Quote__c with a lookup field called Enquiry__c to another custom object Enquiry__c. Eveyrthing I have read implies that in a standard controller for the child Quote__c object, I should be able to access fields in the parent object using dot notation, e.g., I should be able use the following line in an VFpage:

 

<p>Name is: {!Quote__c.Enquiry__c.Name}</p>

 

but when I try to save, I get the error Unknown property 'String.Name'

 

If I put it in an apex field

<p>Name is:<apex:outputField value="{!Quote__c.Enquiry__c.Name}"/></p>

 

I get the error "Could not resolve the entity from <apex:outputField> value binding '{!Quote__c.Enquiry__c.Name}'. outputField can only be used with SObject fields."

 

The documentation is REALLY confusing. In the Visual Force Developers Guide, in the section "Displaying Field Values with VisualForce", it says "You cannot access parent objects using this expression language. In other words, {!account.parent.name} will return an error." Yet, I tried that exact expression (on the implied standard objects) and it worked fine!

 

Then, in a later section "Accessing Data with a Standard Controller", it contradicts the previous statement by saying "You can traverse up to five levels of child-to-parent relationships. For example, if using the Contact standard controller, you can use {!contact.Account.Owner.FirstName} (a three-level child-to-parent relationship)" I tried that expression and IT worked fine.

 

Yet, my custom object expression cannot even access data in the first parent!  Are custom objects treated differently than standard objects by standard controllers?  Any hint as to what is going on would be deeply appreciated!

[I posted this on the formulas board, didn't get a response. So I am reposting it here since, as I am a newbie, this might be a newbie question!]

 

I need to open a VisualForce page based on the value of a RecordType in a custom object. For maintainability, it seemed like the easiest thing was to map the RecordType string to the VFpage name by dropping illegal characters like ampersands, etc.  For instance, if the RecordType was "Flood/Fire Damage" then the page name would be "floodfiredamage". So I coded a URL for a custom detail button like this (the custom object is Quote__c):

 

/apex/{!CASE(Quote__c.RecordType,"Flood/Fire Damage","FloodFireDamage","")}?ID={!Quote__c.Id}

 

(In the real situation, there would be many value/result pairs in the CASE statement, only one is shown here for simplicity.) To my surprise it did not work. After flailing around for a while I coded up the following URL and VFpage to demonstrate the problem (I am using the UPPER function as a simple example of calling a function with a RecordType. The ID parameter and standardController are unnecessary for this test):

 

URL on custom button:

/apex/testpage?ID={!Quote__c.Id}&param1={!Quote__c​.RecordType}&param2={!UPPER( Quote__c.RecordType)}

 

VFpage TestPage contents:

<apex:page standardController="Quote__c">
<p>id={!$Currentpage.parameters.id}</p>
<p>param1={!$Currentpage.parameters.param1}</p>
<p>param2={!$Currentpage.parameters.param2}</p>
</apex:page>

 

And here is the result when I click the button to invoke TestPage:

id=a0750000005PHAf
param1=Employers Liability
param2=01250000000QHEY

 

When used directly, RecordType seems to behave as expected. But, when put inside a function the internal id is passed to the function rather than the string. How do I get it to pass its string value to a function?

 

Any help would be deeply appreciated!

I want to open a VisualForce page based on the value of a RecordType in a custom object. For maintainability, it seemed like the easiest thing was to map the RecordType string to the page name by drop illegal characters like ampersands, etc.  For instance, if the RecordType was "Flood/Fire Damage" then the page name would be "floodfiredamage". So I coded a URL for a custom detail button like this (the custom object is Quote__c):

 

/apex/{!CASE(Quote__c.RecortType,"Flood/Fire Damage","FloodFireDamage","")}?ID={!Quote__c.Id}

 

(In the real situation, there would be many value/result pairs in the CASE statement, only one is shown here for simplicity.) To my surprise it did not work. After flailing around for a long while I coded up the following URL and VFpage to demonstrate the problem (I am using the UPPER function as a simple example for calling a function with a RecordType):

 

URL on custom button:

/apex/testpage?ID={!Quote__c.Id}&param1={!Quote__c.RecordType}&param2={!UPPER( Quote__c.RecordType)}

 

VFpage TestPage contents:

<apex:page standardController="Quote__c">
<p>id={!$Currentpage.parameters.id}</p>
<p>param1={!$Currentpage.parameters.param1}</p>
<p>param2={!$Currentpage.parameters.param2}</p>
</apex:page>

 

And here is the result when I click the button to invoke TestPage:

id=a0750000005PHAf
param1=Employers Liability
param2=01250000000QHEY

 

So, why is it when I use RecordType straight out I get the value but I put it inside a function I get the internal id? And, how do I get around it? Currently, I'm contemplating putting a field in the custom object itself that does the mapping from RecordType name to destination page name and then using that field in the URL but that seems inelegant. (Of course, a a big ugly CASE statement isn't all that elegant either!)

 

Thanks!

I've been fiddling with the IDE and there is something I don't understand. I don't see any way to conveniently execute a VisualForce page from within the IDE. If one is actively developing some relatively complex pages with relatively complex controllers behind them, it would seem that you should be able to edit the controller, maybe edit the page, and run it.

 

Instead, with the IDE, it seems I constantly have to copy my code changes back to the developer site and run them from there. And worse, if I make a quick fix there, I have to remember to copy it back to the IDE or I will lose it. In short, during active development of Apex and VisualForce, the IDE doesn't seem all that helpful. What am I missing?

I have a customer requirement to display a PDF document with various parts of it in "small caps". If I display the document as a regular VF page, its fine. However, when I add the renderAs="PDF" attribute, the small caps disappear. The document is complex with many styling changes and requires a separate style sheet. However, the problem is easy to demonstrate with a simple document, e.g.:

 

<apex:page sidebar="false" standardStyleSheets="false" showHeader="false">
<style type="text/css">
p {font-variant:small-caps;}
</style>
<p>This should be small caps.</p>
</apex:page>

 

The above works as expected.  However, add in the renderAs, and the small caps disappear!

 

I have tried everything. I've tried setting the body selector, I've tried spanning with a class or an id. I've used a separate style sheet, wrapped the text in an apex:outputText tag and then added style and/or styleclass attributes to the apex tag. I've tried specifying font families (which is a real shot in the dark since I've found no documentation on what fonts are available to SFDC's iText instances.)

 

Has anybody seen this before or have a solution or know if this a confirmed bug? [My OS is WinXP SP3 5.1.2600 (i.e. fully up to date) and my Adobe Reader is 8.2.5 (i.e. fully up to date)]

 

I can think of a workaround but for large docs, its ugly. You would change the required words to uppercase and use two fonts, one for trailing parts of words and a larger one for the leading character, where needed.

Is there any documentation anywhere that details what constitutes a valid identifier in APEX? For instance, when trying to compile an apex class, the compiler claims that x__x (two underscores) is an invalid identifier. Oddly, so is x___x (three underscores). As is using the name of a custom object prefixed by anything, like xxxMyObj__c where "MyObj__c" is the custom object.

 

Just curious...

(I am posting this here as I couldn't find a board for just the IDE)

When you create a new "Apex Component" with the IDE, it puts in this awful, long default value for the description that starts out "This is a generic template for Apex Component."  and then runs on and on. I know you can edit the metadata for the component you are creating, but is there a way to change the default value to something else (like maybe a blank) so I don't have to edit it for each new component I create?

I have a custom object Quote__c with a lookup field called Enquiry__c to another custom object Enquiry__c. Eveyrthing I have read implies that in a standard controller for the child Quote__c object, I should be able to access fields in the parent object using dot notation, e.g., I should be able use the following line in an VFpage:

 

<p>Name is: {!Quote__c.Enquiry__c.Name}</p>

 

but when I try to save, I get the error Unknown property 'String.Name'

 

If I put it in an apex field

<p>Name is:<apex:outputField value="{!Quote__c.Enquiry__c.Name}"/></p>

 

I get the error "Could not resolve the entity from <apex:outputField> value binding '{!Quote__c.Enquiry__c.Name}'. outputField can only be used with SObject fields."

 

The documentation is REALLY confusing. In the Visual Force Developers Guide, in the section "Displaying Field Values with VisualForce", it says "You cannot access parent objects using this expression language. In other words, {!account.parent.name} will return an error." Yet, I tried that exact expression (on the implied standard objects) and it worked fine!

 

Then, in a later section "Accessing Data with a Standard Controller", it contradicts the previous statement by saying "You can traverse up to five levels of child-to-parent relationships. For example, if using the Contact standard controller, you can use {!contact.Account.Owner.FirstName} (a three-level child-to-parent relationship)" I tried that expression and IT worked fine.

 

Yet, my custom object expression cannot even access data in the first parent!  Are custom objects treated differently than standard objects by standard controllers?  Any hint as to what is going on would be deeply appreciated!

[I posted this on the formulas board, didn't get a response. So I am reposting it here since, as I am a newbie, this might be a newbie question!]

 

I need to open a VisualForce page based on the value of a RecordType in a custom object. For maintainability, it seemed like the easiest thing was to map the RecordType string to the VFpage name by dropping illegal characters like ampersands, etc.  For instance, if the RecordType was "Flood/Fire Damage" then the page name would be "floodfiredamage". So I coded a URL for a custom detail button like this (the custom object is Quote__c):

 

/apex/{!CASE(Quote__c.RecordType,"Flood/Fire Damage","FloodFireDamage","")}?ID={!Quote__c.Id}

 

(In the real situation, there would be many value/result pairs in the CASE statement, only one is shown here for simplicity.) To my surprise it did not work. After flailing around for a while I coded up the following URL and VFpage to demonstrate the problem (I am using the UPPER function as a simple example of calling a function with a RecordType. The ID parameter and standardController are unnecessary for this test):

 

URL on custom button:

/apex/testpage?ID={!Quote__c.Id}&param1={!Quote__c​.RecordType}&param2={!UPPER( Quote__c.RecordType)}

 

VFpage TestPage contents:

<apex:page standardController="Quote__c">
<p>id={!$Currentpage.parameters.id}</p>
<p>param1={!$Currentpage.parameters.param1}</p>
<p>param2={!$Currentpage.parameters.param2}</p>
</apex:page>

 

And here is the result when I click the button to invoke TestPage:

id=a0750000005PHAf
param1=Employers Liability
param2=01250000000QHEY

 

When used directly, RecordType seems to behave as expected. But, when put inside a function the internal id is passed to the function rather than the string. How do I get it to pass its string value to a function?

 

Any help would be deeply appreciated!

I've been fiddling with the IDE and there is something I don't understand. I don't see any way to conveniently execute a VisualForce page from within the IDE. If one is actively developing some relatively complex pages with relatively complex controllers behind them, it would seem that you should be able to edit the controller, maybe edit the page, and run it.

 

Instead, with the IDE, it seems I constantly have to copy my code changes back to the developer site and run them from there. And worse, if I make a quick fix there, I have to remember to copy it back to the IDE or I will lose it. In short, during active development of Apex and VisualForce, the IDE doesn't seem all that helpful. What am I missing?