Export Options

I have created a preview control in order to open .fpx type reports. What I am needing to do is limit the export/save options under the save button. Is there a way to limit the options? I am using C#. I have read the programmers manual, but I didn't really see anything useful. I appreciate any assistance.

I found something on previous fast reports forums but it doesn't tell you how to access the sub menu items programatically: http://www.fast-report.com/en/forum/lofive....php/t8398.html

Please let me know how to access the submenu items in the Preview Control. Apparently this was fixed back in 2011 according to the forum discussion I just referenced. I am able to add custom buttons, but not remove the export options under save.

Comments

  • edited 11:08PM
    I found this thread: http://www.fast-report.com/en/forum/index....=previewcontrol

    I tried: FastReport.Utils.RegisteredObjects.FindObject(typeof(FastReport.Export.XAML.XAMLExport)).Enabled = false; but it didn't work for me. Would anybody have insight as to what I might be doing wrong?
  • edited August 2014
    Ok, so I've figured out how to get rid of many of the export options. I am going to give a detailed description here so that hopefully many others can benefit from this.

    Here is what I used:
    FastReport.Preview.PreviewControl preview = new FastReport.Preview.PreviewControl();
    ButtonItem btnSave = preview.ToolBar.Items[preview.ToolBar.Items.IndexOf("btnSave")] as ButtonItem;
    btnSave.SubItems.RemoveAt(0);
    btnSave.SubItems.RemoveAt(2);
    btnSave.SubItems.RemoveAt(6);
    btnSave.SubItems.RemoveAt(7);
    btnSave.SubItems.RemoveAt(8);
    btnSave.SubItems.RemoveAt(9);
    btnSave.SubItems.RemoveAt(10);
    btnSave.SubItems.RemoveAt(11);
    btnSave.SubItems.RemoveAt(12);
    btnSave.SubItems.RemoveAt(13);

    0 = Prepared Report
    1 = Rich Text File
    2 = MHT file
    3 = Excel
    4 = Word
    5 = PowerPoint
    6 = OpenOffice Writer
    7 = OpenOffice Writer
    8 = CSV file
    9 = Text File/Matrix Printer
    10 = XAML file
    11 = FTP
    12 = Dropbox
    13 = OneDrive

    There are some others that were not able to be taken off with this method for some odd reason. I am still looking for a way to restrict some of the other options. If anyone knows of any way to do it, please let me know. The index will only allow you to go up to 13 even though Visual Studio locates 20 items in the array in SubItems. Really weird.
  • edited 11:08PM
    Ok, so I finally figured it out. You want to reverse the numbers going from the largest to smallest array number. For example:

    ButtonItem btnSave = preview.ToolBar.Items[preview.ToolBar.Items.IndexOf("btnSave")] as ButtonItem;
    btnSave.SubItems.RemoveAt(22);
    btnSave.SubItems.RemoveAt(21);
    btnSave.SubItems.RemoveAt(20);
    btnSave.SubItems.RemoveAt(19);
    btnSave.SubItems.RemoveAt(18);
    btnSave.SubItems.RemoveAt(17);
    btnSave.SubItems.RemoveAt(16);
    btnSave.SubItems.RemoveAt(14);
    btnSave.SubItems.RemoveAt(13);
    btnSave.SubItems.RemoveAt(12);

    Hope this helps anyone who needs it!
  • edited 11:08PM
    Hi,

    I'm using VB Instead of C#....
    Does anybody know how to use this code in VB? [img]style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> Really need to remove a few of those export options.... Thanks[/img]

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.