Custom text layout

Hello follow coders.
I have been trying my hands at this for quite some time now, and I thought it is time to ask for some help. =)
I'm looking to create a text component in which the text is presented organized in columns, of an arbitrary width, with spaces between the columns. The spaces would not be a space character, but rather just some pixel distance.
Think Hex editor.
ex.
0000 0000 0000 0000
0000 0000 0000 0000
0000 0000 0000 0000.. where the spaces between the sets of zeros would not be treated as characters, just spacing.
The caret should be able to move fluidly within the rows of text, automatically skipping the spaces, without counting them to the offset
ex. the caretpositions would be
Text: 0000 0000 00
Pos:  0123 4567 89So, logically, in the eyes of the component the contents would really just be a large row of characters, only they're displayed as if they had spaces.
I hope my desciption is satisfying, and I hope someone can help me.
My conclusion this far is that the solution would involve overiding the actual paint that paints the text within the text component, but my problem is that I don't really understand the inner workings of the text component...
Cheers
/D

If you want to change the painting behavior in a JTextArea you might start with the
BasicTextUI and View classes.
Here's another approach using a DocumentFilter and a NavigationFilter. Since you indicated
an interest in the painting approach I stopped short of implementing cut, copy and paste
which would be the next step.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
public class Navigate {
    private JScrollPane getContent() {
        JTextArea textArea = new JTextArea() {
            { enableEvents(AWTEvent.KEY_EVENT_MASK); }
            protected void paintComponent(Graphics g) {
                ((Graphics2D)g).setRenderingHint(
                        RenderingHints.KEY_TEXT_ANTIALIASING,
                        RenderingHints.VALUE_TEXT_ANTIALIAS_ON
                super.paintComponent(g);
            protected void processKeyEvent(KeyEvent e) {
                if(e.getKeyCode() == KeyEvent.VK_BACK_SPACE) {
                    try {
                        int pos = getCaretPosition();
                        String s = getDocument().getText(pos-1, 1);
                        if(s.equals(" ")) {
                            e.consume();   // Don't back up.
                            return;
                    } catch(BadLocationException ble) {
                        System.out.printf("BadLocation: %s%n", ble.getMessage());
                super.processKeyEvent(e);
        textArea.setMargin(new Insets(2,5,2,5));
        textArea.setLineWrap(true);
        textArea.setFont(textArea.getFont().deriveFont(18f));
        textArea.setNavigationFilter(new ColumnNavFilter());
        AbstractDocument doc = (AbstractDocument)textArea.getDocument();
        doc.setDocumentFilter(new ColumnDocFilter());
        return new JScrollPane(textArea);
    public static void main(String[] args) {
        JFrame f = new JFrame();
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setContentPane(new Navigate().getContent());
        f.setSize(400,200);
        f.setLocation(600,400);
        f.setVisible(true);
class ColumnNavFilter extends NavigationFilter {
    int maxLength = 19;
    // direction values:
    //     SwingConstants.NORTH = 1
    //     SwingConstants.EAST  = 3
    //     SwingConstants.SOUTH = 5
    //     SwingConstants.WEST  = 7
    public int getNextVisualPositionFrom(
                       JTextComponent text, int pos,
                       Position.Bias bias,  int direction,
                       Position.Bias[] biasRet
                                         ) throws BadLocationException {
        // format    0000 0000 0000 0000
        // pos       0123456789111111111  -> 19 places
        //                     012345678
        int next = text.getUI().getNextVisualPositionFrom(text, pos, bias,
                                                          direction, biasRet);
        //System.out.printf("pos = %d\tbias = %s\tdirection = %d\tnext = %d%n",
        //                    pos, bias.toString(), direction, next);
        // Number of new lines so far.
        int newLines = pos/maxLength;
        // Offset in this line: [0 <= lineOffset <= maxLength]
        int lineOffset = newLines > 0 ? pos%(maxLength+1) : pos;
        switch(lineOffset) {
            case 3:
                if(direction == SwingConstants.EAST)
                    next = pos+2;
                else if(direction == SwingConstants.WEST)
                    next = pos-1;
                break;
            case 5:
                if(direction == SwingConstants.WEST)
                    next = pos-2;
                break;
            case 8:
                if(direction == SwingConstants.EAST)
                    next = pos+2;
                break;
            case 10:
                if(direction == SwingConstants.WEST)
                    next = pos-2;
                break;
            case 13:
                if(direction == SwingConstants.EAST)
                    next = pos+2;
                break;
            case 15:
                if(direction == SwingConstants.WEST)
                    next = pos-2;
                break;
        return next;
    public void moveDot(NavigationFilter.FilterBypass fb,
                        int dot, Position.Bias bias) {
        //System.out.println("moveDot: dot = " + dot + "\tbias = " + bias);
        fb.moveDot(dot, bias);
    public void setDot(NavigationFilter.FilterBypass fb,
                       int dot, Position.Bias bias) {
        //System.out.println("setDot: dot = " + dot + "\tbias = " + bias);
        // Number of new lines so far.
        int newLines = dot/maxLength;
        // Offset in this line: [0 <= lineOffset <= maxLength]
        int lineOffset = newLines > 0 ? dot%(maxLength+1) : dot;
        if(lineOffset == 4) {
            if(bias == Position.Bias.Forward)
                fb.setDot(dot+1, bias);
            else if(bias == Position.Bias.Backward)
                fb.setDot(dot+2, bias);
        else if(lineOffset == 9) {
            if(bias == Position.Bias.Forward)
                fb.setDot(dot+1, bias);
            else
                fb.setDot(dot+2, bias);
        else if(lineOffset == 14) {
            if(bias == Position.Bias.Forward)
                fb.setDot(dot+1, bias);
            else
                fb.setDot(dot+2, bias);
        else
            fb.setDot(dot, bias);
class ColumnDocFilter extends DocumentFilter {
    String domain;
    int maxLength;
    Toolkit toolkit;
    public ColumnDocFilter() {
        domain = "0123456789 \n";
        maxLength = 19;
        toolkit = Toolkit.getDefaultToolkit();
    public void insertString(DocumentFilter.FilterBypass fb,
                             int offset,
                             String str,
                             AttributeSet attrs) throws BadLocationException {
        replace(fb, offset, 0, str, attrs);
    public void replace(DocumentFilter.FilterBypass fb,
                        int offset,
                        int length,               // selected text
                        String str,               // incoming string
                        AttributeSet attrs) throws BadLocationException {
        // format    0000 0000 0000 0000
        // pos       0123456789111111111  -> 19 places
        //                     012345678
        String text = fb.getDocument().getText(0, fb.getDocument().getLength());
        int docLength = text.length();
        //System.out.printf("offset = %d\tstr = %s%n", offset, str);
        // Build replacement string.
        char[] source = str.toCharArray();
        char[] result = new char[source.length + 3];
        int k = 0;
        for(int j = 0; j < source.length; j++) {
            if(domain.indexOf(source[j]) != -1) {
                // Number of new lines so far.
                int newLines = offset/maxLength;
                // Offset in this line: [0 <= lineOffset <= maxLength]
                int lineOffset = newLines > 0 ? offset%(maxLength+1) : offset;
                // Are we at the end of this line?
                boolean lineEnd = offset > 0 && lineOffset % maxLength == 0;
                if(lineEnd)
                    result[k++] = '\n';
                //System.out.printf("offset = %d\tnewLines = %d\tlineEnd = %b\t" +
                //                  "lineOffset = %s%n",
                //                   offset, newLines, lineEnd, lineOffset);
                if(offset > 0 && (lineOffset+1)%5 == 0 &&
                       lineOffset%maxLength != 0 && !str.equals(" ")) {
                    if(docLength > offset) {
                        fb.replace(offset, 2, " " + source[j], attrs);
                        continue;
                    else
                        result[k++] = ' ';
                result[k++] = source[j];
            else
                toolkit.beep();
        fb.replace(offset, length, new String(result, 0, k), attrs);
}

Similar Messages

  • How to add a custom Text Layout for a wiki page

    I'd just like to know if this is even possible. Has anyone ever tried adding a custom text layout as per the attached screenshot?
    Shereen Qumsieh http://sharepointdeveloperhq.com @msshushu

    Hi Shereen, take a look at this blog post:
    http://blog.hompus.nl/2012/06/07/provisioning-a-default-layout-and-content-when-adding-a-wiki-page/
    Dimitri Ayrapetov (MCSE: SharePoint)

  • WDA - customer text in field label in Layout

    Hi,
    I need to display the customer text in field label in Layout. Currently field label text is coming from OTR.
    OTR ‘PAOC_RCF_UI_SELF_SERVICES/MIDDLE_NAME’ has text ‘Second Name’. My customer wants to display ‘Middle Name’ instead of ‘Second Name’.
    How can I fulfill my customer requirement without modyfying WD Component?
    Regards,
    ...Naddy
    Edited by: Naddy on Apr 4, 2008 2:46 PM

    Hi Naddy,
    U can achieve it by enhancing the component , write a post exit for the wdmodifyview
    in that .. for first_time  get the  UI element and set the text as u want.......
    Regards
    Yash

  • Can I create a completely custom page layout for a book, positioning and sizing pictures and text?

    I'd like to create a totally custom page, inserting photos at various locations and sizes as well as text regions.  Can this be done?   I haven't been able to find a way to do this.

    I've found it's worthwhile spending time fiddling and adjusting Lightroom's templates and saving to Custom Pages but I haven't found a way of removing a custom page layout once I've finished using it or tweaked it some more. Can you say how to remove one, please, johnbeardy? I can put them in and out of Favourites but the Custom Pages list just gets too long.

  • Is it possible to create a custom photo layout when creating a photo book in iphoto?

    Is it possible to create a custom photo layout when creating a photobook in iphoto? How about adding text boxes?

    Yes and no
    You can not make a custom template nor can you modify one
    You can do a page in other software and then print to PDF using the send PDF to iPhoto option and place the resulting image as a full page photo - See Old Toad's tutorial No.19 for more information.
    LN

  • Custom control in custom page layout not getting shown

    Hi,
    I have created a site column for Date field:
    <Field ID="{GUID}" Name="MyCustomPageLayoutDate" StaticName="MyCustomPageLayoutDate" Group="TestGroup" Type="DateTime" Format="DateOnly" DisplayName="Date" Required="FALSE" ><Field ID ="{guid}" Name ="MyCustomLayoutDateDisplay" DisplayName="Date Display"
             Group="TestGroup"
             Type="Calculated"
             ResultType="Text"
             ReadOnly="TRUE"
             Required="FALSE">
        <Formula>=TEXT([Date],"MMMM dd, yyyy")</Formula>
      </Field>
    This is added in the page layout content type:
    <FieldRef ID="{guid}" Name="MyCustomPageLayoutDate" />  <FieldRef ID="{guid}" Name ="MyCustomLayoutDateDisplay" />
    In the custom page layout, it is added as below:
    <Publishing:EditModePanel ID="EditModePanel5" runat="server" CssClass="edit-mode-panel">
    <tr>
    <td>
    Date
    </td>
    </tr>
    </Publishing:EditModePanel>
    <PublishingWebControls:EditModePanel ID="DateEditModePanel" runat="server" PageDisplayMode="Edit" SupressTag="True">
    <tr>
    <td >
    <PageFieldDateTimeField:DateTimeField ID="DateTimeField1" FieldName="GUID" runat="server">
    </PageFieldDateTimeField:DateTimeField>
    </td>
    </tr>
    </PublishingWebControls:EditModePanel>
    <PublishingWebControls:EditModePanel ID="DatePublishModePanel" PageDisplayMode="Display" runat="server">
    <tr>
    <td>
    <SharePoint:CalculatedField ID="CalculatedDateField" FieldName="guid" runat="server" />
    </td>
    </tr>
    </PublishingWebControls:EditModePanel>
    In the edit mode, the date is getting shown, and I am able to select a date. When the page is published, the entered date is not getting displayed.
    How to fix this?
    Thanks

    Hi,
    I tried to reproduce this issue like this:
    1. Create a DateTime site column “MyDateTimeCol01”;
    2. Create a Calculated site column “MyCalculated03” with formula “=TEXT(MyDateTimeCol01,"MMMM dd, yyyy")”;
    3. Create a Page Layout content type contains the two site columns above;
    4. Create a Page Layout with the Page Layout content type, the source code of this page layout as below:
    <asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server">
    <PublishingWebControls:EditModePanel runat=server id="EditModePanel1" PageDisplayMode="Edit">
    <SharePointWebControls:DateTimeField FieldName="9492c1ff-851f-4d1c-bcbf-5637b69ebd63" runat="server"> </SharePointWebControls:DateTimeField>
    </PublishingWebControls:EditModePanel>
    <br/>
    <PublishingWebControls:EditModePanel runat=server id="EditModePanel2" PageDisplayMode="Display">
    date time text:
    <br/>
    <SharePointWebControls:CalculatedField FieldName="9c00c4dc-6a53-4abd-9fa4-6b4dd266c898" runat="server"></SharePointWebControls:CalculatedField>
    </PublishingWebControls:EditModePanel>
    </asp:Content>
    5. After that, create a publishing page with this custom page layout:
    In Edit mode:
    In Display mode:
    I suggest you follow the steps above to make another test to see if the issue persists.
    Thanks 
    Patrick Liang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Custom Report Layout in APEX 3.0 PDF

    How much freedom do we have when developing a custom report layout using BI Publisher when we create the template file using the Word XML add-on?
    Why I am asking is, I am trying to replicate several Crystal based reports that use multiple lines of for data. They group on several columns and display the grouped data on separate lines in the report.
    Grouping 1 Line one has customer detail information
    Next grouping 1 or more lines are provider of service line information
    Last Line count of detail lines for customer
    Or would I be better off porting these reports to Oracle Reports?
    Thank you!
    Tony Miller
    UTMB/EHN

    Marc, I was able to create reports based on a layout and a report query...Is it possible to let the end user (not apex developers) download the report layout, make modifications and load it again. They will only be changing the text and very rarely will modify the fields..
    Thanks
    Ashlee
    update: i found the following logic in the f4000 app on page 1405 for download
    declare
    l_report_document blob;
    l_file_ext varchar2(255);
    l_mime_type varchar2(255);
    begin
    for c1 in (
    select *
    from wwv_flow_report_layouts
    where id = :P1405_ID
    ) loop
    if c1.report_layout_type = 'RTF_FILE' then
    l_mime_type := 'application/rtf';
    l_file_ext := 'rtf';
    else
    l_mime_type := 'application/xml';
    l_file_ext := 'xml';
    end if;
    l_report_document := wwv_flow_utilities.clob_to_blob(c1.page_template,wwv_flow_lang.get_db_charset);
    sys.owa_util.mime_header (l_mime_type ,false);
    sys.htp.p('Content-Disposition: attachment; filename='||lower(replace(c1.report_layout_name,' ','_'))||'.'||l_file_ext);
    wpg_docload.download_file( l_report_document );
    end loop;
    end;
    and 1406 for upload
    declare
    l_report_layout clob;
    l_report_layout_id number;
    begin
    for c1 in (
    select blob_content from wwv_flow_files
    where name = :P1406_LAYOUT_FILE
    ) loop
    l_report_layout_id := wwv_flow_id.next_val;
    l_report_layout := wwv_flow_utilities.blob_to_clob(c1.blob_content);
    insert into wwv_flow_report_layouts (
    id,
    flow_id,
    report_layout_name,
    report_layout_type,
    page_template
    ) values (
    l_report_layout_id,
    :FB_FLOW_ID,
    :P1406_REPORT_LAYOUT_NAME,
    'RTF_FILE',
    l_report_layout
    end loop;
    end;
    are these the tables/apis i could use ?

  • Multiple Page Contents Page Fields In Custom Page Layout SP2013

    I'm rather new so bare with me.  I'm trying to add multiple page content page fields with snippets to a custom page layout html file in SP2013 Designer.  Once I add the snippet and publish, I review the page and any text written
    in the last created page content box saves for both page content boxes instead of saving unique text in both.  How do you change the snippets to where they are unique snippets and won't be referenced as the same one? 
    Any help is greatly appreciated.
    Thanks,
    SP2013Newbie

    ok thnaks a lot for the reply. in my form has 6 pages. so i want to copy only first page half page data ( content & fillble fileds) in to new pdf page. so is this possible ???

  • Can I use Text Layout Framework with Flex 3 SDK?

    Greetings,
    I have to develop a complex custom widget, with custom text wrapping behaviour. Text Layout framework seem to offer fine level of control, but we are trying to keep our project in Flash player 9, and therefore we are using Flex 3 sdk.
    Can I use the framework with flex sdk 3 and therefore flash player 9?
    Best Regards
    Seref

    For that you need to install flex sdk 3.5 framework and choose your defauls framework to flex 3.5 it will work and as well instal flash player 10

  • Problem with creating customized report layout

    Hello,
    I want to create customized report layout. However, it doesn't work. Can somebody help me?
    I have a page 24 in apex.oracle.com(workspace: houbcm, username: apex, password: apex1). Here is the code in my .xslt.
    <?xml version="1.0"?>
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <fo:layout-master-set>
    <fo:simple-page-master master-name="content"
    page-width="210mm" page-height="297mm">
    <fo:region-body/>
    </fo:simple-page-master>
    </fo:layout-master-set>
    <fo:page-sequence master-reference="content">
    <fo:flow flow-name="xsl-region-body">
    <fo:table table-layout="fixed" width="100%">
    <fo:table-body>
    <fo:table-row >
    <fo:table-cell> <fo:block text-align='right' > <fo:inline> Product Name: </fo:inline> </fo:block> </fo:table-cell>
    <fo:table-cell> <fo:block text-align='left' > <fo:inline> <xsl:value-of select='.//PRODUCT_NAME' /> </fo:inline> </fo:block> </fo:table-cell>
    </fo:table-row>
    <fo:table-row >
    <fo:table-cell> <fo:block text-align='right' > <fo:inline> Description: </fo:inline> </fo:block> </fo:table-cell>
    <fo:table-cell> <fo:block text-align='left' > <fo:inline> <xsl:value-of select='.//PRODUCT_DESCRIPTION' /> </fo:inline> </fo:block> </fo:table-cell>
    </fo:table-row>
    <fo:table-row >
    <fo:table-cell> <fo:block text-align='right' > <fo:inline> Category: </fo:inline> </fo:block> </fo:table-cell>
    <fo:table-cell> <fo:block text-align='left' > <fo:inline> <xsl:value-of select='.//CATEGORY' /> </fo:inline> </fo:block> </fo:table-cell>
    </fo:table-row>
    <fo:table-row >
    <fo:table-cell> <fo:block text-align='right' > <fo:inline> Availability: </fo:inline> </fo:block> </fo:table-cell>
    <fo:table-cell> <fo:block text-align='left' > <fo:inline> <xsl:value-of select='.//PRODUCT_AVAIL' /> </fo:inline> </fo:block> </fo:table-cell>
    </fo:table-row>
    <fo:table-row>
    <fo:table-cell> <fo:block text-align='right' > <fo:inline> List Price: </fo:inline> </fo:block> </fo:table-cell>
    <fo:table-cell> <fo:block text-align='left' > <fo:inline> <xsl:value-of select='.//LIST_PRICE' /> </fo:inline> </fo:block> </fo:table-cell>
    </fo:table-row>
    </fo:table-body>
    </fo:table>
    </fo:flow>
    </fo:page-sequence>
    </fo:root>
    Thanks,
    Jen

    Hi,
    Thanks for the reply. I have created following report definition.
    SELECT Call_Type.EnterpriseName, Call_Type.Description AS DNIS, Call_Type_Interval.CallTypeID,
    SUM(Call_Type_Interval.ServiceLevelCallsOffered) AS CallsOffered,
    SUM(Call_Type_Interval.CallsAnswered) AS CallsAnswered,
    SUM(Call_Type_Interval.TotalCallsAband) AS TotalCallsAband,
    SUM(Call_Type_Interval.ServiceLevelAband) AS ServiceLevelAband,
    SUM(Call_Type_Interval.ShortCalls) AS ShortCalls,
    SUM(Call_Type_Interval.CallDelayAbandTime) AS CallDelayAbandTime,
    SUM(Call_Type_Interval.AnswerWaitTime) AS AnswerWaitTime,
    SUM(Call_Type_Interval.AnsInterval1) AS AnsInterval1,
    SUM(Call_Type_Interval.AnsInterval2) AS AnsInterval2,
    SUM(Call_Type_Interval.AnsInterval3) AS AnsInterval3,
    SUM(Call_Type_Interval.AnsInterval4) AS AnsInterval4,
    SUM(Call_Type_Interval.AnsInterval5) AS AnsInterval5,
    SUM(Call_Type_Interval.AnsInterval6) AS AnsInterval6,
    SUM(Call_Type_Interval.AnsInterval7) AS AnsInterval7,
    SUM(Call_Type_Interval.AnsInterval8) AS AnsInterval8,
    SUM(Call_Type_Interval.AnsInterval9) AS AnsInterval9,
    SUM(Call_Type_Interval.AnsInterval10) AS AnsInterval10
    FROM        
    Call_Type (nolock),
    Call_Type_Interval (nolock)
    WHERE Call_Type.CallTypeID = Call_Type_Interval.CallTypeID
    AND Call_Type.CallTypeID in (:calltype_list)
    AND Call_Type_Interval.DateTime >= :start_date
    AND Call_Type_Interval.DateTime <= :end_date
    GROUP BY Call_Type.EnterpriseName,
    Call_Type.Description,
    Call_Type_Interval.CallTypeID
    For this definition i wanted to create a customized report which is apparently not possible.

  • Social comment control in custom page layout stucks at "Working" for read access users

    Hi,
    I created a custom page layout which is attched to my custom content type.
    i have a custom field control which is derived from RichImageField.
    i have also added a social comment control to the page layout using
    <SharePointPortalControls:SocialCommentControl ID="SocialCommentControl1" runat="server"  />.
    Now the problem is, an user who have read access for a pages library should post comments. but its not working and when the user clicks post button it stucks at working. but when the user is given contribute access then it works and the comments are posted.
    And one more thing is if i remove my custom field control from the page layout, then user with read access can post the comment without any issues.
    i am sure the issue is caused by my custom field control but dont know how to solve it. i dont want to give contribute access to the users as they can edit the content of the page also. Any help would be appreciated.
    This is the custom field control code.
    public class mycompanyRichImageField : RichImageField
    public static string webimage = null;
    #region Private variables
    /// <summary>
    /// File upload control used to upload image.
    /// </summary>
    private FileUpload fileUpload;
    /// <summary>
    /// Upload button.
    /// </summary>
    private Button btnSave;
    /// <summary>
    /// Delete button.
    /// </summary>
    private Button btnClear;
    /// <summary>
    /// Article image.
    /// </summary>
    private Image imgPicture;
    /// <summary>
    /// Image width.
    /// </summary>
    private DropDownList ddlWidth;
    /// <summary>
    /// Temporary store image url.
    /// </summary>
    private Label lblFileName;
    /// <summary>
    /// Image text.
    /// </summary>
    private TextBox txtImage;
    /// <summary>
    /// Value of image field.
    /// </summary>
    private ImageFieldValue pageImage;
    /// <summary>
    /// List item - current article.
    /// </summary>
    private SPListItem ArticlePage = SPContext.Current.ListItem;
    /// <summary>
    /// The first image width dropdown list options, default value 240 px.
    /// </summary>
    // private int imageWidthWide = 400;
    //private int height = 225;
    /// <summary>
    /// The second image width dropdown list options, default value 120 px.
    /// </summary>
    private int imageWidthNarrow = 126;
    /// <summary>
    /// Picture library to store the image files.
    /// </summary>
    private string imageLibrary = "Images";
    /// <summary>
    /// List field to store Article image.
    /// </summary>
    private string imageField = "Page Image";
    /// <summary>
    /// List field to store image text.
    /// </summary>
    private string imageTextField = "Image Text";
    private string preview = "Preview";
    /// <summary>
    /// List field to store rollup image.
    /// </summary>
    private string rollupImageField = "Rollup Image";
    /// <summary>
    /// Whether to update the rollup image using the current image.
    /// </summary>
    private bool updateRollupImage = false;
    /// <summary>
    /// Whether to display image text.
    /// </summary>
    private bool enableImageText = true;
    #endregion
    #region Properties
    /// <summary>
    /// Gets or sets the first choice of image width.
    /// </summary>
    //public int ImageWidthWide
    // get
    // return this.imageWidthWide;
    // set
    // this.imageWidthWide = value;
    //public int ImageHeight
    // get
    // return this.height;
    // set
    // this.height = value;
    /// <summary>
    /// Gets or sets the second choice of image width.
    /// </summary>
    public int ImageWidthNarrow
    get
    return this.imageWidthNarrow;
    set
    this.imageWidthNarrow = value;
    /// <summary>
    /// Gets or sets the name of the picture library that is used to store image files.
    /// </summary>
    public string ImageLibrary
    get
    return this.imageLibrary;
    set
    this.imageLibrary = value;
    /// <summary>
    /// Gets or sets the field name of image.
    /// </summary>
    public string ImageField
    get
    return this.imageField;
    set
    this.imageField = value;
    /// <summary>
    /// Gets or sets the field name of image text.
    /// </summary>
    public string ImageTextField
    get
    return this.imageTextField;
    set
    this.imageTextField = value;
    /// <summary>
    /// Gets or sets the field name of rollup image.
    /// </summary>
    public string RollupImageField
    get
    return this.rollupImageField;
    set
    this.rollupImageField = value;
    public string Preview
    get
    return this.preview;
    set
    this.preview = value;
    /// <summary>
    /// Gets or sets a value indicating whether to update rollup image using current image.
    /// </summary>
    public bool UpdateRollupImage
    get
    return this.updateRollupImage;
    set
    this.updateRollupImage = value;
    /// <summary>
    /// Gets or sets a value indicating whether the image text should be displayed.
    /// </summary>
    public bool EnableImageText
    get
    return this.enableImageText;
    set
    this.enableImageText = value;
    #endregion
    #region Override methods
    /// <summary>
    /// Using get method instead of set method to set the value.
    /// set method cannot be used here.
    /// </summary>
    public override object Value
    get
    ImageFieldValue value = new ImageFieldValue();
    value.ImageUrl = string.IsNullOrEmpty(this.lblFileName.Text) ? this.imgPicture.ImageUrl : this.lblFileName.Text;
    // value.Width = string.IsNullOrEmpty(this.ddlWidth.Text) ? this.ImageWidthWide : Convert.ToInt32(this.ddlWidth.Text);
    // value.Height = this.ImageHeight;
    ////update the page rollup image.
    if (this.UpdateRollupImage)
    this.ArticlePage[this.RollupImageField] = value;
    if (this.EnableImageText)
    this.ArticlePage[this.ImageTextField] = this.txtImage.Text;
    this.ArticlePage.SystemUpdate(false);
    return value;
    set
    base.Value = value;
    /// <summary>
    /// Intialize all controls.
    /// </summary>
    protected override void CreateChildControls()
    this.pageImage = (ImageFieldValue)this.ArticlePage[this.imageField];
    this.ddlWidth = new DropDownList();
    this.ddlWidth.Width = 99;
    // this.ddlWidth.Items.Add(this.ImageWidthWide.ToString());
    this.ddlWidth.Items.Add(this.ImageWidthNarrow.ToString());
    if (this.pageImage != null && !string.IsNullOrEmpty(this.pageImage.ImageUrl))
    // if (this.pageImage.Width >= this.ImageWidthWide)
    // // this.ddlWidth.SelectedIndex = 0;
    //else
    // // this.ddlWidth.SelectedIndex = 1;
    // this.Controls.Add(this.ddlWidth);
    this.imgPicture = new Image();
    if (this.pageImage != null && !string.IsNullOrEmpty(this.pageImage.ImageUrl))
    this.imgPicture.ImageUrl = SPContext.Current.Site.Url + this.pageImage.ImageUrl;
    this.Controls.Add(this.imgPicture);
    this.fileUpload = new FileUpload();
    this.fileUpload.Width = 180;
    this.Controls.Add(this.fileUpload);
    this.btnSave = new Button();
    this.btnSave.Text = "Upload";
    this.btnSave.CausesValidation = false;
    this.btnSave.Visible = string.IsNullOrEmpty(this.imgPicture.ImageUrl) ? true : false;
    this.Controls.Add(this.btnSave);
    this.btnSave.Click += new EventHandler(this.BtnSave_Click);
    this.btnClear = new Button();
    this.btnClear.Text = "Delete";
    this.btnClear.CausesValidation = false;
    this.btnClear.Visible = !this.btnSave.Visible;
    this.Controls.Add(this.btnClear);
    this.btnClear.Click += new EventHandler(this.BtnClear_Click);
    this.lblFileName = new Label();
    this.Controls.Add(this.lblFileName);
    if (this.EnableImageText)
    this.txtImage = new TextBox();
    this.txtImage.TextMode = TextBoxMode.MultiLine;
    this.txtImage.Rows = 4;
    this.txtImage.Text = this.ArticlePage[this.ImageTextField] == null ? string.Empty : this.ArticlePage[this.ImageTextField].ToString();
    this.Controls.Add(this.txtImage);
    /// <summary>
    /// Render the field in page edit mode.
    /// </summary>
    /// <param name="output">Output stream.</param>
    protected override void RenderFieldForInput(System.Web.UI.HtmlTextWriter output)
    output.Write("<div style='padding-bottom:12px'>");
    if (!string.IsNullOrEmpty(this.imgPicture.ImageUrl))
    output.Write("<br />");
    // this.imgPicture.Width = ((ImageFieldValue)this.Value).Width;
    // this.imgPicture.Height = ((ImageFieldValue)this.Value).Height;
    this.imgPicture.RenderControl(output);
    if (this.EnableImageText)
    this.txtImage.Width = this.imgPicture.Width;
    if (this.EnableImageText)
    output.Write("<br />");
    this.txtImage.RenderControl(output);
    output.Write("<br /><br />");
    this.fileUpload.RenderControl(output);
    this.btnSave.RenderControl(output);
    this.btnClear.RenderControl(output);
    output.Write("<br /><br />");
    //output.Write("Width:");
    //this.ddlWidth.RenderControl(output);
    output.Write("</div>");
    /// <summary>
    /// Render the field in page display mode.
    /// </summary>
    /// <param name="output">Output stream.</param>
    protected override void RenderFieldForDisplay(System.Web.UI.HtmlTextWriter output)
    if (this.ListItemFieldValue != null)
    output.Write("<div style='padding-bottom:12px'>");
    base.RenderFieldForDisplay(output);
    if (this.EnableImageText && this.ArticlePage[this.ImageField] != null
    && this.ArticlePage[this.ImageTextField] != null)
    //string strImgWidth = string.IsNullOrEmpty(this.ddlWidth.Text) ? this.ImageWidthWide.ToString() : this.ddlWidth.Text;
    //string strImgHgt = this.ImageHeight.ToString();
    output.Write("<div style='width:");
    // output.Write(strImgWidth);
    // output.Write(this.imgPicture.ImageUrl);
    // output.Write("<div style='height:");
    // output.Write(strImgHgt);
    output.Write(";margin-right:4px;' align='left'>");
    output.Write(this.ArticlePage[this.ImageTextField].ToString());
    output.Write("</div>");
    output.Write("</div>");
    #endregion
    #region Button events
    /// <summary>
    /// Delete image file from the library and empty the image field.
    /// </summary>
    /// <param name="sender">Delete button.</param>
    /// <param name="e">No arguments.</param>
    protected void BtnClear_Click(object sender, EventArgs e)
    ////remove the image file from the Images library
    using (SPSite site = new SPSite(
    SPContext.Current.Web.Url,
    SpSecurityHelper.GetSystemToken(SPContext.Current.Site)))
    using (SPWeb currentWeb = site.OpenWeb())
    SPDocumentLibrary imageList = (SPDocumentLibrary)currentWeb.Lists[this.ImageLibrary];
    SPFolder rootFolder = imageList.RootFolder;
    try
    currentWeb.AllowUnsafeUpdates = true;
    rootFolder.Files.Delete(this.imgPicture.ImageUrl);
    rootFolder.Update();
    catch
    ////cannot delete specified file, this means file doesn't exist, the file must be deleted
    ////directly in the Images library by someone
    ////don't do anything here
    finally
    currentWeb.AllowUnsafeUpdates = false;
    if (this.pageImage != null)
    this.pageImage.ImageUrl = string.Empty;
    this.imgPicture.ImageUrl = string.Empty;
    this.lblFileName.Text = string.Empty;
    this.btnClear.Visible = false;
    this.btnSave.Visible = true;
    /// <summary>
    /// Upload image file to library and fullfilled the image field.
    /// </summary>
    /// <param name="sender">Upload button.</param>
    /// <param name="e">No argument.</param>
    protected void BtnSave_Click(object sender, EventArgs e)
    this.ArticlePage[this.ImageTextField] = this.txtImage.Text;
    this.ArticlePage.SystemUpdate(false);
    string fileName = this.fileUpload.FileName;
    ////validate file name
    if (fileName == string.Empty || !this.fileUpload.HasFile)
    this.lblFileName.Text = string.Empty;
    if (this.pageImage == null)
    this.Page.ClientScript.RegisterStartupScript(typeof(string), "NoImage", "<script>alert('No image found, please select an image.')</script>", false);
    else
    using (SPSite site = new SPSite(
    SPContext.Current.Web.Url,
    SpSecurityHelper.GetSystemToken(SPContext.Current.Site)))
    using (SPWeb currentWeb = site.OpenWeb())
    SPDocumentLibrary imageList = (SPDocumentLibrary)currentWeb.Lists[this.ImageLibrary]; ////Images
    SPFolder rootFolder = imageList.RootFolder;
    ////the image file name must be unique except for the file name extension
    string imageName = this.ArticlePage.UniqueId.ToString("N") + this.FieldName + Path.GetExtension(fileName);
    ////first delete the image file from the Images library.
    ////if a file with different file name extension is uploaded, the old file won't be overwritten,
    ////and will never be deleted from this page, so it must be deleted before adding a new one.
    if (this.pageImage != null && !string.IsNullOrEmpty(this.pageImage.ImageUrl))
    try
    currentWeb.AllowUnsafeUpdates = true;
    rootFolder.Files.Delete(this.pageImage.ImageUrl);
    rootFolder.Update();
    catch
    ////cannot delete specified file, this means file doesn't exist, the file must be deleted
    ////directly in the Images library by someone
    finally
    currentWeb.AllowUnsafeUpdates = false;
    try
    currentWeb.AllowUnsafeUpdates = true;
    SPFile imageFile = rootFolder.Files.Add(imageName, this.fileUpload.FileBytes, true);
    finally
    currentWeb.AllowUnsafeUpdates = false;
    // this.lblFileName.Text = currentWeb.Site.Url + imageList.RootFolder.ServerRelativeUrl + "/" + imageName;
    this.lblFileName.Text = currentWeb.Site.Url + imageList.RootFolder.ServerRelativeUrl + "/_w/" + imageName.Substring(0, imageName.LastIndexOf(".")) + "_" + imageName.Substring(imageName.IndexOf(".") + 1) + "." + imageName.Substring(imageName.IndexOf(".") + 1);
    // webimage = currentWeb.Site.Url + imageList.RootFolder.ServerRelativeUrl + "/_w/" + imageName.Substring(0,imageName.LastIndexOf("."))+"_"+imageName.Substring(imageName.IndexOf(".")+1) +"." + imageName.Substring(imageName.IndexOf(".")+1);
    this.imgPicture.ImageUrl = this.lblFileName.Text;
    this.btnClear.Visible = true;
    this.btnSave.Visible = false;
    #endregion
    This is how i used it in my page layout
     <Article:mycompnayRichImageField runat="server" ID="RichImageField1" InputFieldLabel="Keep image text short and precise" FieldName="PublishingPageImage" UpdateRollupImage="true"/>
    Aruna

    Hi,
    For this issue, I'm trying to involve someone familiar with this topic to further look at it.
    Thanks,
    Jason Guo
    TechNet Community Support

  • BUG: Can't cut and paste custom text boxes

    So this is really annoying.
    - Create a text box.
    - Set a custom text color, font and size
    - Postion correctly.
    Now I want to copy the text box to another page to maintain my text style. I can copy, but when I paste nothing happens.
    Meaning I have to format each and every text box I create manually. Any work arounds?
    I must say I do find the book editing tools in Aperture eccentric to say the least. No multi-select, no align/distribute etc. - I hope for some better page layout tools in the future. They don't have to be complex - just the basics.

    Eccentric? Yup, my feelings exactly. Copy and paste in Aperture's layout tool is hit and miss - and as far as I know it's the only Mac app that behaves in this way, which is very strange indeed.
    I just tried a workaround by saving the page with custom text as a new page master: it doesn't work!
    Aperture only saves where the text box is located but all text formating reverts back to the theme's default... There's also no way to save custom text styles.
    What will work is duplicating the page that contains the styled text box you'd like to keep. But then you need to change all the rest of the layout around it manually, which may take even longer.
    It's nice to have a layout tool in Aperture. But considering what Apple has at its disposal, the implementation is extremely frustrating...

  • Custom Page layout and related tmp files causing issues

    Hello,
    I am trying to create custom page layouts using Design Manager and then editing the html file using a text editor.
    I have created a content type (inherited from Page content type) and used this content type for my page layout. I used the snippet manager to add relevant webpart zones and snippets I needed and published the page layout. Under status it shows conversion
    successful but I can see another file with similar name to my page laout but with ~RF119c862.TMP being created. 
    Even if I publish my page layout my webparts (via snippets I added) doesn't reflect in the page. I checked the preview of my page layouts and webparts appear when it is in draft mode but the moment I publish it loses all snippets (webparts). 
    I checked the html even after the page layout is published and I can see all webpart zones, my divs and snippet code there, somehow once I publish it the corresponding aspx page doesn't get updated.
    Has anybody come across this before, I'm trying this on Office 365 tenant site.
    Regards,
    Manoj
    -- The opinions expressed here represent my own and not those of anybody else -- http://manojvnair.blogspot.com

    I have seen a similar problem on-prem when a client had distributed cache misconfigured, but as your problem is with SPO, I doubt that is the problem.
    Try creating another page layout but keep its associated content type untouched. Try adding snippets and such, publish and see what happens. If that works, then there must be something wrong with your custom content type.
    Also, when you save a change to your .html page layout, open its associated aspx page layout in SPD and see if your changes were reflected there as well. As soon as your edit a html page layout and save your changes, SharePoint should automatically update
    your aspx page layout right away.
    Eric Overfield - PixelMill -
    blog.pixelmill.com/ericoverfield -
    @EricOverfield

  • Custom Page Layout and strange web part behaviour

    Hi.
    I've added some additional web part zones to a new table in a custom page layout but when I deploy the page layout and apply it to an existing page, if I add a CEWP to the new zones the ribbon doesn't respond and I can only modify the CEWP if I move it to
    one of the other OOTB zones on the page.
    I can move the CEWP back and forth between the zones but the ribbon only reacts and allows me to really customize the web part once it's been moved to one of those original zones.
    I can add any web part to the new zones but the CEWP, when initially added to the page, just shows the "Click here to add new content" text/link and clicking it does nothing.
    The strange thing is that if I select and then copy that text/link, the text disappears and I can type in the CEWP.
    Adding a CEWP to one of the original zones just works. I click the link, the text disappears and I can start editing.
    Have I missed something in the code on the customized page layout or is this just a bug or some other quirk?
    Thanks peeps.
    N03L.

    Hi,
    This depends on the IView properties, so open IView properties in property editor and play around with
    Height properties like Height Type, MaxAutoHeight, MinAutoHeight.
    Regards,
    Praveen Gudapati

  • Custom page layouts for iPhoto books- bleeds and type

    I've been digging through the forum for info on creating custom page layouts. I have the basics: print PDF (to capture the page BG and graphics elements), manipulate in PhotoShop and place the custom page as a full page photo.
    How does iPhoto deal with bleeds? Since I'm trying to recreate the style of the other pages I'd like it to match.
    Is all type in an iPhoto book rasterized? The printed PDF retains type. Will rasterized type in PS layouts match "native" text in iPhoto?
    I haven't purchased a book yet and I'm wondering if the book is sent to Apple as a PDF with vector data. If that's the case can custom pages be inserted into the PDF with vector type intact?
    Thanks all!
    rg

    gatz:
    Welcome to the Apple Discussions. I don't know much about bleeds but you can manipulate it in the iPhoto preference file with Pref Setter.
    Regarding the rasterized type, you'll have to give it a try and then create a pdf of the book to check it out. In iPHoto 5 we used to be able to get a copy of the pdf file that was uploaded to Apple but in V6 that's not possible. I think the pdf file may be the same as we get when creating it via Print to PDF. Here's the info I received from Apple about book quality and materials:
    I contacted Apple and asked for information that I could pass on. Here's the reply I received from Apple:
    "Thank you for contacting the Apple Print Products Customer Service.
    I understand that you would like to know the printing process that is used and the color mode the files should be in, so you can better advise users in the iPhoto forum.
    iPhoto version 4 or later, allows you to import and print files through the Apple Print Product service as RGB, grayscale, or CMYK color space. JPEG files with RGB color space are recommended for best results.
    While iPhoto 2 can import files of various formats, including RGB color, grayscale, and CMYK, this version requires JPEG files with RGB color space when printing photos and books.
    For more information regarding iPhoto 2, please visit the following article:
    iPhoto: Color, Black and White Prints Appear Garbled or Distorted
    For more information regarding iPhoto 5, please visit the following article:
    http://docs.info.apple.com/article.html?artnum=165501
    Here are some of the technical specifications for the books, cards, and calendars. I hope this gives you an idea about their quality and form.
    BOOKS
    All iPhoto books are printed using acid-free paper for long-lasting image quality. The photos are printed at a high resolution (300DPI if you use iPhoto 6). There is no external modification--such as sharpening or contrast adjustment--of the photos; what you see in the application is what is printed in the book.
    Hardcovers Books
    The cover is hard-bound and covered in linen. You select the linen color during the book-ordering process. The hardcover books have a solid, stiff binding that is glued and crimped. The internal pages, measuring 8.5 x 11 inches, are printed on McCoy 100# Text Gloss paper stock.
    Softcover Books
    The softcover books come in three sizes:
    - Large 8.5 x 11 inches
    - Medium 6 x 8 inches
    - Small 2.6 x 3.5 inches
    All of the softcover books have internal pages that are printed on McCoy 100# Text Gloss paper stock. The large softcover book has a white cover (Kromekoteplus Folding Cover, 16 point) with a cutout on the front that reveals the cover-page photo in the book. The covers for the medium and small softcover books have the cover image and title printed directly on the cover. All of the softcover books have a glued binding and feature a thick cover of McCoy 100# Cover Gloss paper stock.
    CARDS
    All cards are printed on McCoy 120# Silk Cover paper stock. The postcards measure 4 x 6 inches, and the greeting cards measure 5 x 7inches.
    CALENDARS
    All calendars measure 8 x 10 inches and are printed on McCoy 100# Silk Cover paper stock.
    To ensure the best print quality, we have chosen to use Kodak NexPress technology. The press uses a dry toner, which is fused to the surface of the paper. Please see NexPress' site for more information:
    KODAK NEXPRESS 2500 Digital Production Color Press
    I hope you find this information helpful in answering questions on the iPhoto forum."
    Do you Twango?
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've written an Automator workflow application (requires Tiger), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.

Maybe you are looking for

  • Net Price Calculation During Creation of PO with Reference to Contract

    Hi, While trying to Create Purchase Order through ME21N transaction , For a line item When Contract and Contract Item is given as Reference then the Net Price of PO is calculated automatically , When Tried to Debug Standard code the Function Module "

  • How to add other SAP systems in CCMS ALE Monitoring

    Hi all, how do I add other SAP systems to be ALE monitored centrally in the PI system? I want to monitor the Idocs in the SAP R/3 system centrally in PI with CCMS. Default is only ALE for the PI system itself.

  • Logging Invoke-Command

    Hello, I have a problem with logging on multiple servers at the same time. I would like to have a single file with every log formated like this : "yyyyMMdd HH:mm:ss - $Env:ComputerName - result of the command" To know what computer is doing what, I a

  • Moving from flash CC trial to paid version

    I installed a trial version of Flash CC - it has now expired.  I joined the Creative Cloud single-app membership for Flash Professional (one-year) - I was presented with a download button, this evoked my Creative cloud, the Flash CC instance now read

  • IDVD 6

    I am new to iDVD 6 having just upgraded from iDVD 5. I have just taken 211 photos from iPhoto, created a slideshow using the new Wizard in iDVD, I included the theme and the slideshow of 211 pictures, included some audio and then burnt the DVD. When