Telerik:Radgridview Export to excel - telerik-grid

I am using a telerik Radgridview in one of the my reports.
I have to export the result into Excel, for that I am using telerik's inbuild ExportToExcel
function this will export my result successfully to excel format. But my requirement is that I want to show the Header also in the generated Excel
Please advise

I found the solution for this. To achieve this we need to add following event:
protected void RadGrid1_ExcelMLExportRowCreated(object sender, Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLRowCreatedArgs e)
{
if (e.RowType == Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLRowType.HeaderRow)
{
e.Worksheet.WorksheetOptions.PageSetup.PageHeaderElement.Data = "This is the DRAFT Data";
}
}
It will work for me.

Related

How to Format Export Excel Sheet using Angular

Need to export json data to the excel file(large data), I can able to download the file and need to do some styles to the excel file(font, color, headers). I tried file-saver, Could you please suggest how to format the excel file.
loadData() {
const dataUrl =
'https://raw.githubusercontent.com/l-lin/angular-datatables/master/demo/src/data/data.json';
this.http.get(dataUrl).subscribe(response => {
this.data = response.data;
});
}
exportAsXLSX(): void {
this.excelService.exportAsExcelFile(this.data, 'PersonsData');
}
Export to excel
Unfortunately, the SheetJS package you are using only offers style features in the PRO version. You cannot add a style without having the PRO version.

VSTO-Excel Custom Task Pane AutoResize based on Screen Resolution

I have a problem with my VSTO addin for excel.
I tried creating custom task pane fot my addin. However, when I tried to deploy it on a screen with different resolution from the developer's monitor, the addin does not automatically fits the screen. Note: my clients have different screen resolution.
On my vsto project, i tried to create a custom user control, and attach it on the excel pane.
Please see my code below:
private void btnDownload_Click(object sender, RibbonControlEventArgs e)
{
taskPaneView = new ucCusipAddPanel();
if (myTaskPane == null)
{
myTaskPane = Globals.ThisAddIn.CustomTaskPanes.Add(taskPaneView, "My Custom Task Pane");
myTaskPane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight;
myTaskPane.DockPositionRestrict = Office.MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoChange;
myTaskPane.Visible = true;
myTaskPane.Width = 303;
}
else
{
myTaskPane.Visible = true;
taskPaneView.BringToFront();
taskPaneView.Focus();
}
}
ucCusipAddPanel is the name of my user control.
This is how invoke my custom taskpane upon ribbon button click. I already set the AutoSize property to true of my user control however still the problem exists.
How could I resolve this?
Thank you in advance.
You need to play with the AutoScaleMode of the myTaskPane object.
I think the correct solution is to use: myTaskPane.AutoScaleMode = AutoScaleMode.Dpi;
see MSDN

PR_ATTR_HIDDEN property is missing when a new folder is created in outlook 2013

I am developing an Outlook 2013 addin using c#. As part of the requirement I need to enumerate all the visible folders. Following is the sample code that I am using.
public List<Outlook.Folder> EnumerateFolders(Outlook.Folder parentFolder)
{
List<Outlook.Folder> allFolders = new List<Outlook.Folder>();
EnumerateFolders(parentFolder, allFolders);
return allFolders;
}
public void EnumerateFolders(Outlook.Folder parentFolder, List<Outlook.Folder> allFolders)
{
Outlook.Folders childFolders = parentFolder.Folders;
if (childFolders.Count > 0)
{
foreach (Outlook.Folder childFolder in childFolders)
{
try
{
bool isHidden = childFolder.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x10F4000B");
if (!isHidden)
{
allFolders.Add(childFolder);
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
}
// Call EnumerateFolders using childFolder.
EnumerateFolders(childFolder, allFolders);
}
}
}
The problem I am facing here is, if I create a new folder under root folder and execute the above code I am getting an error "MAPI property 0x10F4000B is not found". 0x10F4000B is for PT_ATTR_HIDDEN.
If I create new folder using OWA, then this property is available. It is not available only when I create the folder in Outlook 2013.
Can somebody please help me in understanding what is the problem here.
Thanks in advance.
You cannot expect any MAPI property is to be available. It just happens that OWA sets that property to false. Outlook only cares about the property being true. If the property is missing, it assumes the folder must be shown (PR_ATTR_HIDDEN = false).

Customizing upload file functionality in SharePoint picture library

Can anyone help me ,I want to customize upload functionality in which i want to validate the uploaded image type to the picture library
where can i set my script ?? Any one can advise ???
You might be Use ItemAdding. In ItemAdding Event Method just check extension of the Document before successfully uploaded to the Library.if unvalid document than through Error message
your code something like this :
protected string[] ValidExtensions = new string[] { "png", "jpeg", "gif"};
public override void ItemAdding(SPItemEventProperties properties)
{
string strFileExtension = Path.GetExtension(properties.AfterUrl);
bool isValidExtension = false;
string strValidFileTypes = string.Empty;
using (SPWeb web = properties.OpenWeb())
{
foreach (string strValidExt in ValidExtensions)
{
if (strFileExtension.ToLower().EndsWith(strValidExt.ToLower()))
{
isValidExtension = true;
}
strValidFileTypes += (string.IsNullOrEmpty(strValidFileTypes) ? "" : ", ") + strValidExt;
}
// Here i am going to check is this validate or not if not than redirect to the
//Error Message Page.
if (!isValidExtension)
{
properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl;
properties.RedirectUrl = properties.WebUrl + "/_layouts/error.aspx?ErrorText=" + "Only " + strValidFileTypes + " extenstions are allowed";
}
}
}
You could use SPItemEventReceiver for your library and add your logic into ItemUpdating() and ItemAdding() methods.
You can try creating a custom list template and replace the default NewForm.aspx and EditForm.aspx pages there. These custom form templates need not contain the same user controls and buttons as in the default picture library template. You could create a Silverlight web part with rich UI to upload images, e.g. The more you want to differ the more code you'll have to write...
An OOTB solution I can think of would be a workflow that you would force every new picture to run through but it would be quite an overkill for the end-user...
Of course, if you're able to validate by using just the meta-data in ItemAdding as the others suggest, it'd be a huge time-saver.
--- Ferda

Check if form is changed in ext-gwt and highlight save button

this might be a simple question.
we have a form with different widgets, tables and etc.
in that form we need to highlight save button and enable/disable other action buttons
right after a user changed form data.
do you know about any elegant way to handle dirty forms
I like http://plugins.jquery.com/project/dirtyform but this is not gxt.
Thank you,
SLava
If you are using FormBindings and BeanModel then just implement a changeListener to your BeanModel and do what you need to in that method.
For example:
myBean= BeanModelLookup.get().getFactory(MyBean.class)
.createModel(myBean);
myBean.addChangeListener(new ChangeListener() {
public void modelChanged(ChangeEvent event) {
PropertyChangeEvent propertyEvent = (PropertyChangeEvent) event;
if (!propertyEvent.getOldValue().toString().equals(
propertyEvent.getNewValue().toString())) {
hasBeanChanged= true;
}
}
});

Resources