I have used standard report designer in winform and added a button "Export to PDf" in designer bar.
I want that when i click on this button , opened report or edited report in designer should be exported in pdf.
Please give solution to do this.
You need to add a button in the ribbon and enable the export command with that button. See the below code snippet from the DevExpress sample project for reports in version 14.2.5.
Create a button item in PrintPreview tab and specify it's properties as below:
private DevExpress.XtraPrinting.Preview.PrintPreviewBarItem printPreviewBarItem23;
this.ribbonControl1.Items.AddRange(new DevExpress.XtraBars.BarItem[] {
.....
this.printPreviewBarItem23
.....
};
//
// printPreviewBarItem23
//
this.printPreviewBarItem23.ButtonStyle = DevExpress.XtraBars.BarButtonStyle.DropDown;
this.printPreviewBarItem23.Caption = "Export To";
this.printPreviewBarItem23.Command = DevExpress.XtraPrinting.PrintingSystemCommand.ExportFile;
this.printPreviewBarItem23.ContextSpecifier = this.xrDesignRibbonController1;
this.printPreviewBarItem23.Enabled = false;
this.printPreviewBarItem23.Glyph = ((System.Drawing.Image)(resources.GetObject("printPreviewBarItem23.Glyph")));
this.printPreviewBarItem23.Id = 91;
this.printPreviewBarItem23.LargeGlyph = ((System.Drawing.Image)(resources.GetObject("printPreviewBarItem23.LargeGlyph")));
this.printPreviewBarItem23.Name = "printPreviewBarItem23";
-GUI view
You can add a single command button to just export it to pdf, but you need to check for that specific properties you need to set on the control. You can do above programmatic work in Report designer.
Hope this help.
Related
Are AX dialog buttons limited to OK and Cancel?
Is it possible to add a custom button to the dialog?
I have the following code for my dialog:
static void mitTabPage(Args _args)
{
Dialog dialog;
DialogGroup dialoggroup, dialoggroup2;
DialogField dialogfield, dialogfield2;
;
dialog = new Dialog ("A new Dialog");
dialog.addTabPage("Brand Id's");
dialoggroup = dialog.addGroup("Brand Id's");
dialogfield = dialog.addField(extendedTypeStr(SYCCarBrandId));
dialog.addTabPage("Owners");
dialoggroup2 = dialog.addGroup("Owners");
dialogfield2 = dialog.addField(extendedTypeStr(SYCOwner));
dialog.run();
}
I'd like to add another button to the dialog. How can I do that?
The Dialog framework is a simple framework for prompting users to obtain some data/settings then performing some action or canceling.
For what you're trying to do, it most likely doesn't make sense to use the dialog framework and instead you could/should create another form if you need additional functionality.
However, if you do insist on using the Dialog framework for this, you would add a runtime button and use registerOverrideMethod.
See following links:
https://msdn.microsoft.com/en-us/library/dialogfield.registeroverridemethod.aspx
https://blogs.msdn.microsoft.com/axsupport/2015/06/07/using-x-to-add-a-control-at-runtime/
I am using telerik reporter and I have set my background image with following code:
this.Style.BackgroundImage.ImageData = System.Drawing.Image.FromFile(HttpContext.Current.Server.MapPath(emzaUrl));
When I run the project, background image is not shown in printpreview mode but when I hit print button in reportviewer the background will appear ... I want to show background in print preview mode to allow user to decide what background should he/she use... what is the problem with print preview mode?
I had set background manually through properties window but the problem exist yet...
Answer:
I used water mark at last:
Telerik.Reporting.Drawing.PictureWatermark pictureWatermark1 = new Telerik.Reporting.Drawing.PictureWatermark();
pictureWatermark1.Image = "http://www.telerik.com/images/reporting/cars/NSXGT_7.jpg";
pictureWatermark1.Position = Telerik.Reporting.Drawing.WatermarkPosition.Behind;
pictureWatermark1.PrintOnFirstPage = true;
pictureWatermark1.PrintOnLastPage = true;
pictureWatermark1.Sizing = Telerik.Reporting.Drawing.WatermarkSizeMode.ScaleProportional;
pictureWatermark1.Opacity = 1;
report1.PageSettings.Watermarks.Add(pictureWatermark1);
Looks like the property you are trying to set has been changed overtime and some issue may be still affecting it.
try this:
report.Style.BackgroundImage.ImageData = System.Drawing.Image.FromFile(HttpContext.Current.Server.MapPath(emzaUrl));
For some more reference about this problem you can find some more details here.
Update
I do not know your context because you have not described it. Since your problem may be caused by using a property that is not in use anymore, the answer above is to indicate that the property has been replaced by a new one with reference to the Telerik post detailing the topic.
However, you can add background images to your report in the whole report, in the header section, in the detailed section and in the footer section.
In this picture you can see that I have added the background images in all 4 cases above described.
To achieve the above I have simply used the property of each section adding the picture.
The relevant code generated in the designer.cs of the report is the following:
// pageHeaderSection1
//
this.pageHeaderSection1.Height = Telerik.Reporting.Drawing.Unit.Cm(2.5D);
this.pageHeaderSection1.Name = "pageHeaderSection1";
this.pageHeaderSection1.Style.BackgroundImage.ImageData = ((System.Drawing.Image)(resources.GetObject("pageHeaderSection1.Style.BackgroundImage.ImageData")));
this.pageHeaderSection1.Style.BackgroundImage.MimeType = "image/gif";
this.pageHeaderSection1.Style.BackgroundImage.Repeat = Telerik.Reporting.Drawing.BackgroundRepeat.NoRepeat;
//
// detail
//
this.detail.Style.BackgroundImage.ImageData = ((System.Drawing.Image)(resources.GetObject("detail.Style.BackgroundImage.ImageData")));
this.detail.Style.BackgroundImage.MimeType = "image/gif";
this.detail.Style.BackgroundImage.Repeat = Telerik.Reporting.Drawing.BackgroundRepeat.NoRepeat;
//
// pageFooterSection1
//
this.pageFooterSection1.Style.BackgroundImage.ImageData = ((System.Drawing.Image)(resources.GetObject("pageFooterSection1.Style.BackgroundImage.ImageData")));
this.pageFooterSection1.Style.BackgroundImage.MimeType = "image/gif";
this.pageFooterSection1.Style.BackgroundImage.Repeat = Telerik.Reporting.Drawing.BackgroundRepeat.NoRepeat;
//Report1
this.Style.BackgroundImage.ImageData = ((System.Drawing.Image)(resources.GetObject("Report1.Style.BackgroundImage.ImageData")));
this.Style.BackgroundImage.MimeType = "image/gif";
Here you can find a video with the result. If you still have problems, please describe accurately your context (versions, code, type of report if it is in a class library or if it is a trdx, etc..). With the information you have supplied this is the best I could answer.
Alternatively you may try to set a watermark instead of the background picture.
I have a modal popup that appears whenever an editor tries to save a component with some values (a date field in the past in this case).
In this popup I show the editor a few options (very similar to the default "Open Shared Item" dialog) and an OK/Cancel button combo. On Cancel I fire the "cancel" event and the editor goes back to the editing screen, all good here. On "OK" I want to change the value of the field to match whatever the editor selected, then save.
I tried to use an approach with FieldBuilder and the sample Boris mentioned on this other topic but I can't get to the field from my popup dialog.
Any suggestions on how I can go and modify the xml of the item (could be also a page) from a modal popup?
EDIT: Code used in getControlForFieldName
function getControlForFieldName(name) {
var fieldBuilder = $display.getView().properties.controls.fieldBuilder;
var fieldsContainer = fieldBuilder.properties.input;
var fieldsNode = fieldsContainer.getElement();
var fieldContainer = $dom.getFirstElementChild(fieldsNode);
while (fieldContainer) {
var labelNode = $dom.getFirstElementChild(fieldContainer);
var fieldNode = $dom.getNextElementSibling(labelNode);
var control = fieldNode.control;
if (control.getFieldName() == name) {
return control;
}
fieldContainer = $dom.getNextElementSibling(fieldContainer);
}
}
EDIT #2
After Frank's advice, and some help from Jaime & Frank offline, I got it to work as follows:
The popup is called from a Command Extension (Save & Close in my case)
The command.js specifies an event handler that gets called on "submit" (== OK was pressed)
$evt.addEventHandler(p.dialogPopup, "submit",
this.getDelegate(this._onPopupSubmit));
In my popup I am passing the selected item (it's a keyword ID) to the event handler:
this.fireEvent("submit", { id: select.options[select.selectedIndex].value });
and now back in the event handler _onPopupSubmit(e) I just read e.data.id, load this keyword, get properties like ID & Title, and update the metadata of the item using item.setMetadata("new metadata with updated values").
Simple :)
Your code runs in a popup, so any references you make to global variables will be taken from the popup window.
So when you get the fieldBuilder:
var fieldBuilder = $display.getView().properties.controls.fieldBuilder;
$display is a reference to a global variable. So this actually looks for the FieldBuilder in the popup window (which doesn't have one).
To get the FieldBuilder of the Component window, you can get it from the opener:
var fieldBuilder = opener.$display.getView().properties.controls.fieldBuilder;
You might want to consider actually passing the updated value to either a callback function or with a (custom) event though, since that makes your popup less dependent on opener. trick.
I created a SWT based Wizard which has an own help Button by custom. Now i want to put some content behind that, so maybe a SWT browser will be openend and a predifined HTML Doc will be shown. But I don't have any clue where to access the Actions of the Help Button within my Wizard. Any idea?
I am assuming that you are using the standard JFace interfaces and classes for the wizard implementation. So, in your wizard page (extending org.eclipse.jface.wizard.WizardPage) you just have to override the performHelp method. See the below snippet.
#Override
public void performHelp()
{
Shell shell = new Shell(getShell());
shell.setText("My Custom Help !!");
shell.setLayout(new GridLayout());
shell.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
Browser browser = new Browser(shell, SWT.NONE);
browser.setUrl("http://stackoverflow.com/questions/7322489/cant-put-content-behind-swt-wizard-help-button");
browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
shell.open();
}
>>Wizard image
>>After pressing the help button
I have a grid view on my page, and a hidden details view.
When the user wants to add a new entry, they will click a button, and the gridview will become hidden and the details view will become visible. The only problem is I want my details view to automatically be set empty in the NEW mode, without them having to click the new in the details view form.
In the RowCommand event of the gridview:
myDetailsView.Visible = true;
myDetailsView.CurrentMode = DetailsViewMode.Insert;
myGridView.Visible = false;
On button click change the mode like:
DetailsView1.ChangeMode(DetailsViewMode.Insert)