Beiträge von psswp

    No information found in the pdf manual and the forum, so here is my question.
    I use the following code to setup the page properties of the viewed document.

    Code
    WPRichText1.PaperDefs.Init(true); // Needed for page setup dialog!
      WPRichText1.ReadPrinterProperties;
      WPRichText1.Header.Landscape := False;
      WPRichText1.Header.PageSize := wp_DinA4;
      WPRichText1.Header.UsedUnit := UnitCm;



    My actual printer supports those parameters, but when I click on the File->Setup Page menu item, the paper size and units are not the same, so how can I sinchronize my page setup with the dialog.

    Using XE2 with WPTools versión 7.21

    If I click to File->Preview menú item, the print preview window is shown, with a small window size, so, I add the following code to my application:

    Code
    // Create the data module
      mWPDefaultActions := TWPDefAct.Create(Self);
    
    
       // Preview Window
      mWPDefaultActions.WPPreviewDlg1.DefaultWidth := 800;
      mWPDefaultActions.WPPreviewDlg1.DefaultHeight := Screen.WorkAreaHeight - 100;

    Now, I want to further customize this window. By default the four buttons shown at top left appear disabled, so, I want to enable at least the print button.
    Also, I want to offer to the user the possibility to change the zoom factor, so is it possible to include a zoom combobox to choose that zoom factor.

    Thanks for your info, too easy for what we are used to.

    As this is my occupation for this week, i am interested in to know how do you do for having so much IDEs in one machine.

    For what I am reading in serveral forums, there is a system path length limit, and the best solution that I have found is to delete all references to Delphi from the system path, and then execute rsvars.bat for the IDE you want to work with.

    Using wPDF4 Standard with XE2.
    Using the wPDF demo in the WPTools folder.
    In the code for the "to PDF" button I am adding my license registration
    WPDF_Start('mylicname', 'myliccode');
    Doing nothing else, I click "to PDF" button.
    Then a message apears telling "Cannot start PDF Document".
    How can I solve this problem ?

    Tried uncommenting pdf.DebugMode line, but there is no information in the manual about what it does.

    As explained before, what I want to do is to change the location of an existing menu item in the standard wpDefAction7 Menu control to another place.

    As you can see in the code, I do not create another menu item, but use the existing mWPDefaultActions.ext1 menu item. If I use the following code, it is not enough because clicking that menu does not activate the standard action.

    What I want to know is what I am missing in the following code to get the menu activated when clicked.

    Code
    mnu.Add(mWPDefaultActions.ext1);

    As you know ways better than me, mWPDefaultActions.ext1 is the standard action for the "Delete" menu item.

    I am trying to make all changes to the MainMenu object of the wpDefACtion7 modifying it from my own routines, to avoid to spend several hours each time WPTools changes version.

    To adapt the standard MainMenu to my program, I need to delete some items, and change the level of some other.

    In that case, I can not get the changes working. What, I am trying to delete the menu "Delete" and their subitems from the "Edit" main menu, and then pass the "Del" subitem to depend directly from the "Edit" main menu.

    Code for finding and delete items is working, and also the inserted menu is apearing, but nothing happens when I clic into the inserted "Del" menu.

    This is the code I am using:

    How can I make the last mnu.Add code to work ?

    Using XE2 on a Dell Windows 7 Pro 32 bits.
    The function WPToolsVersion indicates that my version is 7.07.
    Demo project WPMiniEditor.dproj (5_Mini_Delphi5_Editor) does not include WPDefActions7 in the uses clause. In WPDefActions7, I can see included wpobj_image.pas in the uses clause, in practically all other modules there is not a reference to this module.

    Hello Julian

    Demo project WPMiniEditor.dproj (5_Mini_Delphi5_Editor) has practically no code, not to say that TextObject.ObjRef.Compress is not present in any part of this demo.

    If I scan text in the WPTools\XE2 or WPTools\Source folders, also there is not any presence of TextObject.ObjRef.Compress, unless in the WPOBJ_Image file, where this code is only part of a comment at the top of the file.

    Either way, compressed or not compressed, the file generated with wobRTF does not contain any image as seen in the rtf file pasted in one of my replies.

    Hello Julian,

    As you can see in the rtf of my last reply, there is not any indication of compressed data, only I can see some small portion of code related to images at the end of the rtf file, like {\pict}\par.

    In my program, I use wobRTF and WPRichText1.SaveToFile(msFileName); which uses InsertGraphicDialog, but with the same result as mentioned.

    So, and going into the million dollar question, what code must I use to save a document that contains a small bmp to an RTF file, and get some kind of Word compatibility when loading the saved file, or doing a copy from WPRichText and pasting to Word.

    Hello Julian,

    As mentioned before, I am using the demo project 5_Mini_Delphi5_Editor, and I made sure that WriteObjectMode is wobRTF.

    Then, I inserted a small bitmap (150x179) using the "Insert image" button present in the toolbar.

    Then I saved the document to file, using the "Close" button present in the toolbar.

    Looking at the file, its size is 691 Bytes, and it does not contain the image.

    If I open the saved file with NotePad, i can see a reference to "\pict" at the end, but not the bytes with the image.

    {\rtf1\ansi\deff0\uc1\ansicpg1252\deftab720{\fonttbl{\f0\fnil\fcharset1 Arial;}{\f1\fnil\fcharset2 Wingdings;}{\f2\fnil\fcharset2 Symbol;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;}\wpprheadfoot1\paperw12240\paperh15840\margl1880\margr1880\margt1440\margb1440\headery720\footery720\endnhere\sectdefaultcl{\*\generator WPTools_7.000;}{\plain\f0\fs22{\pict}\par
    }}

    Does the 5_Mini_Delphi5_Editor use InsertGraphicDialog on its internals ?

    Using WPTools 7.07 with XE2.

    After searching in this forum, I can not figure out how to save an RTF text file with inserted images, and that the saved file could be opened using Word or WordPad (If it is possible).

    As a starting point, I am using the demo project 5_Mini_Delphi5_Editor, where I made sure that WriteObjectMode was wobRTF.
    I wrote down some text, and using the toolbar buttons, I inserted a small bitmap, and then saved the RTF in a file on disk.

    With wobRTF or wobRTFNoBinary, the bitmap is not saved in the file.
    With wobStandard, wobStandardAndRTF, wobStandardNoBinary, the bitmap is saved, and I can load it again using the demo project.
    None of those formats apears to be compatible with Word or WordPad.
    Also if I select all the text and image, copy and paste in Word, the image is not pasted.

    It is possible to get Word/WordPad compatibility ?

    I have detected a different behaviour when loading a document in debugging mode or executing the compiled file.
    In debugging mode, the file loads correctly, but executing the compiled file, it loads only strange characters.
    As the RTF file used to test is very small, I am inserting it below.
    I want to know what is the difference, and how can I solve it.

    {\rtf1\ansi\ansicpg256{\fonttbl{\f0\fnil Tahoma;}}{\colortbl\red0\green0\blue0;}\uc0 \ql\f0\fs24 \par\par\par\par\par\par \par \par\par \fs32 [NOMAPLL]\par\par \fs28 [ALER][PATO]\fs24 [TOX][GINE][QUIR]\par\par \fs28 [CURSO]}

    I am creating a new blank document, and in the initialisation code, I use a very small margin just to know if it is working.

    Those margins are not reflected in the dotted lines representing the usable area.

    Trying to debug this, I see that the UpdatePageInfo procedure in the WPRTEDefs module is void, and does not contain any code.

    I am using version 7.07, and if I look to my previous version (7.03) there is some code in that function.

    So, my questions are:

    1.) How a simple matter like configuring margins to a new document is properly done.

    2.) As UpdatePageInfo has no code, is this a bug, or this function will be deprecated in the future.

    After looking at UpdatePrinterProperties, and in respect to:

    Zitat

    2.) How can I get printer parameters programmatically like printer name, orientation, paper size after calling WPRichText1.PrinterSetup.

    What I want to do is to update my form data with the printer name just selected.

    I tried to implement the events TWPDefAct.WPAPrinterSetup1AfterExecute and TWPDefAct.aView_PrinterSetupAfterExecute through the StdActions control in wpDefActions7, but none of both are called after WPRichText1.PrinterSetup terminates.

    So, is there a way to get the printer name once PrinterSetup dialog is terminated, and preferably without changing the control source code.

    Using code from the demos, I am creating the first row of a table, and later, I want to add more rows.

    The created row is shown to the user in the editor, and acts as a header, and also as a template, the user can change text properties and widths of the colums.

    Table creation uses the following code

    Code
    var  tbl: TParagraph;  // Create the table and after that modify the cells  WPRichText1.BeginTable('NAME', 0, 0, 0);  tbl := WPRichText1.TableAdd(4, 1, [wptblActivateBorders], nil, nil);  WPRichText1.EndTable;  // Set text of columns  tbl.Rows[0].Cols[0].SetText('Product');  tbl.Rows[0].Cols[1].SetText('Price');  tbl.Rows[0].Cols[2].SetText('Amount');  tbl.Rows[0].Cols[3].SetText('Total');

    Then, when the user wants to print the resulting document, I am adding rows with the following code

    The problem is that ASetCharStyle does not delete the bold flag from the new row, so how can I delete the bold flag from all the content of a table cell.