Gregg,
Sorry for missing this post. I will update you on this case in a couple of days.
~nilay
Gregg,
Sorry for missing this post. I will update you on this case in a couple of days.
~nilay
Dear C1 support,
There is one requirement of FlexGrid.
I need update whole row of the FlexGrid in Bold and Italic after selection of any single cell of FlexGrid.
Also need to update selected cell as Bold.
Currently I am working on WPF(XAML + C#).
Please let me know the solution for above case.
Please provide some sample example if possible.
Thanks and Regards,
Mayur Gosavi
Hi,
well it is not possible to share the whole code, but the following should show how it works:
public class ExcelSheetFlexGrid : C1FlexGrid
...
public ExcelSheetFlexGrid(XLSheet xlSheet, int firstRowIndex, int firstColumnIndex, int rowCount, int columnCount, int headerRowCount = 1)
{
...
}
public override CellRange GetMergedRange(int row, int col, bool clip)
{
for (int mergedRangeIndex = 0; mergedRangeIndex < Sheet.MergedCells.Count; mergedRangeIndex++)
{
var mergedRange = Sheet.MergedCells[mergedRangeIndex];
if ((row >= mergedRange.RowFrom - m_FirstRowIndex) && (row <= mergedRange.RowTo - m_FirstRowIndex) && (col >= mergedRange.ColumnFrom - m_FirstColumnIndex) && (col <= mergedRange.ColumnTo - m_FirstColumnIndex))
{
return GetCellRange(mergedRange.RowFrom - m_FirstRowIndex, mergedRange.ColumnFrom - m_FirstColumnIndex, mergedRange.RowTo - m_FirstRowIndex, mergedRange.ColumnTo - m_FirstColumnIndex);
}
}
return base.GetMergedRange(row, col, clip);
}
public void ResizeColumnWidths(ISet<int> sizeableColumnIndices)
{
/* get the available grid with, i.e. subtract all column widths of non-sizeable columns: */
int intWidth = ClientSize.Width;
for (int columnIndex = 0; columnIndex < Cols.Count; columnIndex++)
{
if (sizeableColumnIndices.Contains(columnIndex) == false)
{
intWidth -= Cols[columnIndex].WidthDisplay; // subtract the display width
}
}
// set the width of the sizeable columns:
int sizeableColumnWidth = (intWidth / sizeableColumnIndices.Count);
foreach (var columnIndex in sizeableColumnIndices)
{
Cols[columnIndex].WidthDisplay = sizeableColumnWidth;
}
}
/// <summary>Initialize the grid with the content of the Excel sheet.
/// </summary>
protected virtual void EstablishGrid()
{
AllowMerging = AllowMergingEnum.Free;
for (int columnIndex = 0; columnIndex < Cols.Count; columnIndex++)
{
Cols[columnIndex].AllowMerging = true;
Cols[columnIndex].AllowSorting = false;
Cols[columnIndex].AllowFiltering = C1.Win.C1FlexGrid.AllowFiltering.None;
}
for (int rowIndex = 0; rowIndex < m_RowCount; rowIndex++)
{
Rows[rowIndex].AllowMerging = true;
for (int columnIndex = 0; columnIndex < m_ColumnCount; columnIndex++)
{
var excelCell = Sheet[rowIndex + m_FirstRowIndex, columnIndex + m_FirstColumnIndex];
this[rowIndex, columnIndex] = excelCell.Value;
CellStyle cellStyle = this.Styles.Add(Guid.NewGuid().ToString()); // arbitrary name
BorderDirEnum borderDirection = BorderDirEnum.Horizontal;
TextAlignEnum textAlignment = TextAlignEnum.LeftCenter;
if (excelCell.Style != null)
{
if (excelCell.Style.BorderRight != XLLineStyleEnum.None)
{
borderDirection = BorderDirEnum.Both;
}
cellStyle.Format = XLStyle.FormatXLToDotNet(excelCell.Style.Format, CultureInfo.InvariantCulture);
if (excelCell.Style.AlignHorz == XLAlignHorzEnum.Center)
{
textAlignment = TextAlignEnum.CenterCenter;
}
cellStyle.WordWrap = excelCell.Style.WordWrap;
cellStyle.Font = new Font(excelCell.Style.Font.FontFamily, 8, excelCell.Style.Font.Style); // here we use a small font size for the preview output
}
cellStyle.TextAlign = textAlignment;
cellStyle.Border.Direction = borderDirection;
this.SetCellStyle(rowIndex, columnIndex, cellStyle);
}
}
this.AutoSizeCols();
}
}
Best wishes
Markus
Hi Mayur Gosavi,
We have tested the provided sample application (Wpf_C1FlexGrid_ContextMenu_Updated2.zip) and below are our observations:
1. Context Menu: If single cell is copied and multiple cells are selected and paste operation is performed then, only data get pasted on last selected cell.
Keyboard: If single cell is copied and multiple cells are selected and paste operation is performed then, only data get pasted on first selected cell.
2. Context menu: We can copy paste data from external excel sheet.
Keyboard: We can copy paste data from external excel sheet.
3. Context menu: We can copy paste data from one instance of application to another instance.
Keyboard: We can copy paste data from one instance of application to another instance.
We have tested this behaviour with the latest builds of C1Wpf i.e; 4.0.20162.524 under Windows 7 (32-bit) machine environment.
Hence, we request you to please share the sample application and the video file representing the issues you are facing.
Thanks,
Akshay
Thanks for confirming. I've forwarded this to our development team for review.
Regards,
Ankit
Hi,
FlexChart only supports formatting gridlines on a whole via the Axis' MajorGridStyle and MinorGridStyle properties'. Formatting a specific gridline is not supported. You should be able to get the desired behavior with Annotations. They would be available in our v3 release scheduled for next month.
Meanwhile you can use the chart's rendering engine in the Rendered event to draw the desired line. Attached is an image and the code snippet for the same:
private void OnRendered(object sender, C1.WPF.Chart.RenderEventArgs e)
{
var chart = sender as C1.WPF.Chart.C1FlexChart;
var count = (chart.ItemsSource as IList).Count;
var start = chart.DataToPoint(new Point(-0.5, 0));
var end = chart.DataToPoint(new Point(count - 0.5, 0));
e.Engine.SetStrokeThickness(2);
e.Engine.SetStroke(new SolidColorBrush(Colors.Black));
e.Engine.DrawLine(start.X, start.Y, end.X, end.Y);
}
Hope this helps.
Regards,
Ankit
Hi,
Thanks for providing the screenshot.
In order to change the Foreground of the partial text inside a certain cell in a grid you need create a class that inherits from CellFactory, with a constructor that accepts a string value. Then override its CreateCellContent method. In it use TextRange class to apply custom formatting.
For more information follow the link given below:
http://our.componentone.com/2013/03/02/highlight-search-string-in-wpf-c1datagrid-and-c1flexgrid/
Hope it helps.
Thanks,
Akshay
Dear C1,
1. I have query related to Copy/Paste operation on C1TreeView.
Do you have any sample code which i can refer for copy/paste functionality.
(Copy selected node and paste it on another node)
Note: we are refering dictionary key/value pair to save data.
2. Currently I am facing bellow challenge, if you have any solution to that then please share
When i select any node i get key/value pair data and when i tried to paste that node after updating the value it gives me error. (Reason for error - save key is already exists)
So do you have any mechansim using whhich i can update the key available in dictionary?
(In dictionary key and value is same - refer attached key/value screenshot and treeview screenshot)
Provide the solution on high priority.
Thanks
Ankit,
That code sample worked out perfectly. Thanks for the help.
Howdy,
I'd like the offline installed for the latest C1Studio Enterprise+Ultimate.
Thanks in advanced,
Hi,
Please download the offline installers for ComponentOne Studio, Wijmo and Xuni (products included in Ultimate Edition) from the links below:
http://cdn.componentone.com/files/studioinstaller/C1StudioInstaller20162.2.9.exe
http://www.goxuni.com/download/
~Pragati
Hi experts,
i am trying to use formulas in my excel, i need stuff like COUNTIF, IF.
For some reason i am always receiving an error when i try to open the excelsheet, when excel repairs the worksheet, it removes the formulas from the sheet.
Here is a short example which causes an error:
sheet[0, 0].Formula = "COUNTIF(S3:S6;8)";
Any ideas what i am doing wrong?
KR Manuel
Hi,
Thanks for the reply.
I'd like to have the packages separated like it existed before and not in a bundle, the C1LiveInstaller previously allowed to save them in the harddisk before the installation, and not start the installation.
Can you point the link to each of them? or or to make the installed save them on the hard disk?
Thanks in advanced,
Jorge Bastos
I am looking for a way to Merge a List
Note: Reports can have any number of pages and can be both Landscape and Portrait.
Thank You
same problem, cannot view PDF
Hi,
When I use the built-in method to save and then load a Gantt chart into a Ganttview, the actual chart doesn't display after loading. Any idea what's causing this?
And is there any documentation anywhere of how to hook a database or .Net datatable object up to the ganttview object? My ideal outcome is being able to generate the data in the Gantt directly from the existing data in the DB.
Thanks
We are using the C1RichTextBox in our WPF app (version 4.0.20152.479). We are having trouble because the user typing in the box does not cause the Text property to update. The Html property does update but there is no obvious way to force Text to be updated from the Html. Could anyone offer advice?
Hi Mayur Gosavi,
You can apply CellStyle objects accordingly in SelectionChanging event of FlexGrid to apply style on whhole row. Furrthermore, in order to apply style on a particular cell you need to apply custom CellFactory on FlexGrid.
Below is the code to achieve the same:
CellStyle cell, row, reset;
private void Window_Loaded(object sender, RoutedEventArgs e)
{
List<Emp> list = new List<Emp>();
list.Add(new Emp { Name = "James", Salary = 100000 });
list.Add(new Emp { Name = "Mike", Salary = 10000 });
list.Add(new Emp { Name = "Lee", Salary = 90000 });
list.Add(new Emp { Name = "Jack", Salary = 70000 });
list.Add(new Emp { Name = "Mia", Salary = 340000 });
list.Add(new Emp { Name = "Den", Salary = 2000 });
list.Add(new Emp { Name = "Saigel", Salary = 50000 });
list.Add(new Emp { Name = "Dmitry", Salary = 90000 });
list.Add(new Emp { Name = "Yen", Salary = 6000 });
list.Add(new Emp { Name = "Alison", Salary = 56000 });
list.Add(new Emp { Name = "Dom", Salary = 10000 });
list.Add(new Emp { Name = "Mathew", Salary = 7000 });
list.Add(new Emp { Name = "Michael", Salary = 920000 });
flex.ItemsSource = list;
reset = flex.Rows[1].CellStyle;
cell = new CellStyle();
cell.FontWeight = FontWeights.Bold;
row = new CellStyle();
row.FontStyle = FontStyles.Italic;
row.FontWeight = FontWeights.Bold;
flex.Rows[flex.Selection.Row].CellStyle = row;
flex.SelectionChanging += Flex_SelectionChanging;
flex.CellFactory = new CustomCellFactory();
}
private void Flex_SelectionChanging(object sender, CellRangeEventArgs e)
{
flex.Rows[flex.Selection.Row].CellStyle = reset;
flex.Rows[e.Row].CellStyle = row;
}
}
class Emp
{
public string Name { get; set; }
public Int32 Salary { get; set; }
}
class CustomCellFactory : CellFactory
{
public override void CreateCellContent(C1FlexGrid grid, Border bdr, CellRange rng)
{
base.CreateCellContent(grid, bdr, rng);
if(grid.Selection.Row == rng.Row && grid.Selection.Column == rng.Column)
{
TextBlock tb = (TextBlock)bdr.Child;
tb.FontWeight = FontWeights.Bold;
tb.FontStyle = FontStyles.Normal;
}
}
}
Please refer to the attached sample application.
Regards,
Akshay Madan
Hi Guy,
If I remember correctly, it is a bug and we have fixed it in 2016v3.
Please refer to "Date Binding" section in this link: http://prerelease.componentone.com/help/WPF/WPF.GanttView.pdf
Thanks
I Have just installed Studio 2016 v2 on top of my Studio enterprise 2009, in a Visual Studio 2015 (windows form vb project). My projects will compile and run, but the component into the project continue as before. For example, when I ask "about C1FlexGrid..." to a FlexGrid component on one of my form, the response is version 2.6.20082.380.
Are there a way to automatically update all my form to the new version of the Component One last version?
Best Regards
Victor