Telerik Forums
UI for WinForms Forum
1 answer
7 views

I am having issues where data getting exported to an XLSX file where some tabs are not getting the data. FileExportMode is set to FileExportMode.NewSheetInExistingFile and the file is not in use.  The weird part, is I can run the code multiple times and each time, it is different tabs that don't get populated. In the end, I  should end up with 14 tabs and I get those 14 tabs, the only thing that is in the tabs, is the headers.  if I export that data for each tabs individual to their own file, the data is there and exported as expected.  Maybe I am missing something?

Another weird part, is when I watch the file exporting (in window explorer), you can see the file go to 0KB. It is really weird

Here is my export code


         List<Tuple<int, string, bool>> jurisdictionTypes =
            new JurisdictionTypeDA().GetJurisdictionTypeKeyValueList();

         foreach (Tuple<int, string, bool> jurisdictionType in jurisdictionTypes)
         {
            RadPivotGrid tempPivotExportGrid = new RadPivotGrid
            {
               ColumnGrandTotalsPosition = TotalsPos.None,
               ColumnsSubTotalsPosition = TotalsPos.None,
               EmptyValueString = "0",
               RowGrandTotalsPosition = TotalsPos.None,
               RowsSubTotalsPosition = TotalsPos.None
            };

            var exportResults = _apportionmentInfoPivot
               .Where(app => app.JurisdictionTypeKey == jurisdictionType.Item1
               .OrderBy(app => app.PartySort)
               .ThenBy(app => app.LegacyKeyValue)
               .Select(app => new
               {
                  jurisdiction_name = app.JurisdictionName?.Trim() ?? string.Empty,
                  party_name = app.PartyName?.Trim() ?? string.Empty,
                  totalvoters = app.TotalVoters,
                  signaturesneeded = app.SignaturesNeeded
               })
               .ToList();

            tempPivotExportGrid.DataSource = exportResults;
            tempPivotExportGrid.RowGroupDescriptions.Clear();
            tempPivotExportGrid.ColumnGroupDescriptions.Clear();
            tempPivotExportGrid.AggregateDescriptions.Clear();

            // Row Information
            PropertyGroupDescription myRows = new PropertyGroupDescription
            {
               PropertyName = "jurisdiction_name",
               CustomName = "Jurisdiction",
               SortOrder = Telerik.Pivot.Core.SortOrder.None
            };

            tempPivotExportGrid.RowGroupDescriptions.Add(myRows);

            // Column Information
            PropertyGroupDescription myCols = new PropertyGroupDescription
            {
               PropertyName = "party_name",
               CustomName = "Party",
               SortOrder = Telerik.Pivot.Core.SortOrder.None
            };
            tempPivotExportGrid.ColumnGroupDescriptions.Add(myCols);

            // Aggregate Information
            tempPivotExportGrid.AggregateDescriptions.Add(new PropertyAggregateDescription()
            {
               PropertyName = "totalvoters",
               CustomName = "Count",
               AggregateFunction = AggregateFunctions.Sum,
               StringFormat = "#,##0"
            });

            tempPivotExportGrid.AggregateDescriptions.Add(new PropertyAggregateDescription()
            {
               PropertyName = "signaturesneeded",
               CustomName = "Needed",
               AggregateFunction = AggregateFunctions.Sum,
               StringFormat = "#,##0"
            });

            tempPivotExportGrid.AggregatesPosition = PivotAxis.Columns;

            // Combine each result into a new tab
            PivotGridSpreadExport spreadExport = new PivotGridSpreadExport(tempPivotExportGrid)
            {
               SheetName = jurisdictionType.Item2,
               FileExportMode = FileExportMode.NewSheetInExistingFile
            };
            spreadExport.RunExport(myExportFile, new SpreadExportRenderer());

            // Send each result to their own sheet
            PivotGridSpreadExport mySpreadExport2 = new PivotGridSpreadExport(tempPivotExportGrid)
            {
               SheetName = jurisdictionType.Item2,
               FileExportMode = FileExportMode.CreateOrOverrideFile
            };
            string newfile = string.Concat(Path.Combine(Path.GetDirectoryName(myExportFile) ?? string.Empty, Path.GetFileNameWithoutExtension(myExportFile)), "_", jurisdictionType.Item2, Path.GetExtension(myExportFile));
            mySpreadExport2.RunExport(newfile, new SpreadExportRenderer());


         }

Due to the nature of the data, I can't share the results, so I will try to re-create this in a temp project.

 

I have attached a like to a video, you can see at 4 seconds and 9 seconds, the file is emptied (0 KB).

https://app.screencast.com/6SjZNCAoooWUh

TIA for any help here.

 

Dinko | Tech Support Engineer
Telerik team
 answered on 27 Feb 2024
3 answers
22 views

Probably more of a suggestion than a question.

I would like an FileExportMode that is between the 2 existing modes. It creates or overrides the named Sheet in the given XLSX

User could then:

  • Export to a named sheet.
  • Add another sheet that references the exorted data
  • Run the Export again to refresh the data
Nadya | Tech Support Engineer
Telerik team
 answered on 10 Nov 2023
2 answers
53 views

I would like to know how to access the values that are typed in all the "Value Filter" and "Label Filter" options, which appear in the PivotGrid filters in the RowGroupDescriptions and ColumnGroupDescriptions parts, since I require those values to perform additional calculations.

I have tried to reach the values but I only reach the Type of condition and the value, I provide the code that I use for what I mention:

foreach (PropertyGroupDescriptionBase gd in this.radPivotGrid1.RowGroupDescriptions)
{
ValueGroupFilter Filtroporvalor = gd.GroupFilter as ValueGroupFilter;                    

if (Filtroporvalor.Condition != null)
{
ComparisonCondition condition = Filtroporvalor.Condition as ComparisonCondition;

var condicionaux = condition.Condition;
var valorthan = condition.Than;

switch (condicionaux.ToString())
{
case "Equals":
//Code that performs additional calculations
break;
case "IsGreaterThan":
//Code that performs additional calculations
break;
case "IsDoesNotEqual":
//Code that performs additional calculations
break;
}
}
}

But I cannot reach the other values, for example if I use "Equals", I would also like to obtain the name of the field that is used to perform that condition and so on for the other options of "Value Filter", that field is the one that is you can select in the window that is displayed when the filter is applied:


Thank you for your support.

Dinko | Tech Support Engineer
Telerik team
 answered on 22 Sep 2023
1 answer
22 views

I know how to sort column chooser for RadGridview:

e.ColumnChooser.SortOrder = RadSortOrder.Ascending

is there a way to sort Field Chooser for RadPivotGrid too?

Dinko | Tech Support Engineer
Telerik team
 answered on 01 Aug 2023
1 answer
47 views

Hi, good morning.

I am using a Pivotgrid, PivotFieldList and Chartview.

The chartview graphs whatever the Pivotgrid has, but there are times when the Pivotgrid has too many records and the Chartview takes a long time to generate.

As seen in the documentation, a Chartview takes time, because it is recalculating the points to regenerate the graph, after having created it previously.

This has led me to think that if instead of the Chartview graphing the Pivotgrid, it would better graph a DataTable.

My idea is the following:
I already generated a filtered DataTable, the result of the interaction between the Pivotgrid and the PivotFieldList and that DataTable fills the Chartview to generate the graph, I think it would take less time to create the graph, since each time the filtered DataTable would be created.

I was looking at this example that you provide to create a graph from a datatable:
https://www.telerik.com/forums/use-radgridview-as-a-datasource-for-radchartview

But it does not graph as expected, that is, it does not show the graphs the same as when the pivotgrid is filled.

Is it possible to do this, or even if you do, will the graph creation time be the same? Because if so, there is no point in working on this solution.

 

Thank you very much for your attention.

Dinko | Tech Support Engineer
Telerik team
 answered on 20 Jun 2023
1 answer
33 views

Hello good afternoon.

I ask for your support, for the following.

In a graph, when there are many elements in X, the labels come together a lot and the text is not understood.

 

When I apply a configuration by code, the graph does look better:

            horizontalAxis.MajorTickInterval = 10;
            horizontalAxis.TickLength = 10;
            horizontalAxis.TickWidth = 10;

 

I would like to start from the number of elements on the X axis that the labels begin to join, to automatically apply the aforementioned code.

My fear is that at some point, it doesn't graph well and it jumps strangely when graphing, could this happen?

Thank you so much
Dinko | Tech Support Engineer
Telerik team
 answered on 19 Jun 2023
1 answer
38 views

Hi,

I have a pivotgrid table like this:

true  |  vegetables    |   data   |  data  |  data
         |  fruit                |   data   |  data  |  data
         |  subtotal         |   data   |  data  |  data
----------------------------------------------------
false  | vegetables    |   data   |  data  |  data
          | fruit                |   data   |  data  |  data
          | subtotal         |   data   |  data  |  data 
How can i change the row header (true, false that are boolean values) using specifically cellformating?

Dinko | Tech Support Engineer
Telerik team
 answered on 20 Apr 2023
1 answer
36 views

Hello,

I am trying to export a radPivotGrid into excel as per the documentation

 

 private void radButton1_Click(object sender, EventArgs e)
        {
            SaveFileDialog sf = new SaveFileDialog();
            sf.Filter = "EXCEL | .xls";
            if (sf.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                // Telerik.WinControls.UI.Export.ExportToExcelML htmlexport = new Telerik.WinControls.UI.Export.ExportToExcelML(radPivotGrid_StockPositionPivot);
                //  htmlexport.RunExport(sf.FileName);


                PivotGridSpreadExport spreadExport = new PivotGridSpreadExport(radPivotGrid_StockPositionPivot);
                spreadExport.RunExport(@"..\..\exported-file.xlsx", new SpreadExportRenderer());
            }
        }

 

the red marked position is throwing an exception, and code suggestion is asking to create a new class to implement SpreadExortRenderer I am not sure how it can be done, any help will be appreciated. TIA

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 06 Mar 2023
3 answers
115 views

I have a Pivot Grid, that has a data set that has two fields, In those fields, it's possible that records in that collection could have empty string value. And if I set one field to be my column group and the other to be my row group and one of those fields as my aggregate count field, everything looks fine, and as expected.   

However, as soon as I filter the ROW GROUP other than the EMPTY value, it drops the COLUMN groups "EMPTY" string column, as well, as if I filter the COLUMN GROUP on a non-empty value, it removes the ROW GROUP's empty string row.  I am not sure if this is by design or what but, this is causing an issue for our customers as they cannot figure out why their numbers in this pivot grid are not the same in other reports (non-pivot).  NOTE, if I filter in either the GROUP or COLUMN fields for the "EMPTY" string value, all the EMPTY string values still show in the COLUMN/ROW groups.  

As a solution to this problem, I made sure that these "EMPTY" string fields has at least one empty space in them... Attached is my sample project.  Once you run the form, just filter either the ROW or COLUMN group on anything other than the EMPTY string value.

 

Thanks

Dinko | Tech Support Engineer
Telerik team
 answered on 22 Feb 2023
1 answer
64 views

Hello,

I am working on the development of an application and I have some doubts in the handling of the PivotFieldList control.

I would like to know how to enter the onclick event of the "Update" button of the PivotFieldList, I want to place some validations when clicking on that button.

 

I would also like to know how to access the onclick event of the "OK" button that appears in each filter of the fields that are displayed in the PivotGrid, because I also want to add some validations when the button is clicked.

Thanks for the support.

Dinko | Tech Support Engineer
Telerik team
 answered on 21 Nov 2022
Narrow your results
Selected tags
Tags
GridView
General Discussions
Scheduler and Reminder
Treeview
Dock
RibbonBar
Themes and Visual Style Builder
ChartView
Calendar, DateTimePicker, TimePicker and Clock
Buttons, RadioButton, CheckBox, etc
DropDownList
ComboBox and ListBox (obsolete as of Q2 2010)
ListView
Chart (obsolete as of Q1 2013)
Form
PageView
MultiColumn ComboBox
TextBox
Menu
RichTextEditor
PropertyGrid
RichTextBox (obsolete as of Q3 2014 SP1)
Panelbar (obsolete as of Q2 2010)
Tabstrip (obsolete as of Q2 2010)
MaskedEditBox
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
GanttView
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
AutoCompleteBox
Label
VirtualGrid
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
ProgressBar
Rotator
TrackBar
MessageBox
CheckedDropDownList
SpinEditor
StatusStrip
CheckedListBox
Wizard
ShapedForm
SyntaxEditor
TextBoxControl
LayoutControl
CollapsiblePanel
Conversational UI, Chat
DateTimePicker
CAB Enabling Kit
TabbedForm
DataEntry
GroupBox
ScrollablePanel
WaitingBar
ImageEditor
ScrollBar
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
PopupEditor
RibbonForm
TaskBoard
Barcode
Styling
ColorBox
PictureBox
Callout
VirtualKeyboard
FilterView
Accessibility
DataLayout
NavigationView
ToastNotificationManager
CalculatorDropDown
Localization
TimePicker
ValidationProvider
FontDropDownList
Licensing
BreadCrumb
ButtonTextBox
LocalizationProvider
Dictionary
Overlay
Security
Separator
SparkLine
TreeMap
StepProgressBar
SplashScreen
ToolbarForm
NotifyIcon
Rating
TimeSpanPicker
BarcodeView
Calculator
OfficeNavigationBar
Flyout
TaskbarButton
HeatMap
SlideView
PipsPager
+? more
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?