No cache version.

Caching disabled. Default setting for this page:enabled (code LNG204)
If the display is too slow, you can disable the user mode to view the cached version.

XMLDgv.cs

Description du code

XMLDgv.cs est un fichier du projet BrolDev.
Ce fichier est situé dans /var/www/bin/sniplets/bibliobrol/broldev/src/.

Projet BrolDev : Librairie de composants réutilisables pour les applications BrolDev en CSharp.

Code source ou contenu du fichier

  1. using System;
  2. using System.Data;
  3. using System.Windows.Forms;
  4. using be.gaudry.view.dialogs;
  5.  
  6. namespace be.gaudry.view.utils.dgvFactory
  7. {
  8. public class XMLDgv : AbstractDgv
  9. {
  10. #region declarations and constructors
  11. private SaveFileDialog saveFileDialog;
  12. public XMLDgv()
  13. {
  14. saveFileDialog = new SaveFileDialog();
  15. saveFileDialog.CheckPathExists = true;
  16. saveFileDialog.CheckFileExists = false;
  17. saveFileDialog.AddExtension = true;
  18. saveFileDialog.CreatePrompt = true;
  19. saveFileDialog.DefaultExt = ".xml";
  20. saveFileDialog.Filter = "XML (*.xml)|*.xml|Tous les fichiers (*.*)|*.*";
  21. saveFileDialog.FilterIndex = 1;
  22. }
  23. #endregion
  24.  
  25. public override void print(DataGridView dgv)
  26. {
  27. this.dgv = dgv;
  28.  
  29. DialogResult dr;
  30. if (dialogOwner != null)
  31. {
  32. dr = saveFileDialog.ShowDialog(dialogOwner);
  33. }
  34. else
  35. {
  36. dr = saveFileDialog.ShowDialog();
  37. }
  38. if (dr == DialogResult.OK)
  39. {
  40. print(saveFileDialog.FileName);
  41. }
  42. }
  43.  
  44. private void print(string destinationFile)
  45. {
  46. bool writed = false;
  47. //StreamWriter writer = new StreamWriter(destinationFile, false);
  48. try
  49. {
  50. DataTable dataTable = getDGVDataTable();
  51. dataTable.WriteXml(destinationFile);
  52. //writer.Write(getDGVString());
  53. writed = true;
  54. }
  55. catch (Exception e)
  56. {
  57. ExceptionDialog.ShowDialog(e, this.dialogOwner);
  58. }
  59.  
  60. if (writed)
  61. {
  62. CustomOpenResultFileDialog.Show(
  63. this.dialogOwner,
  64. destinationFile,
  65. "Le fichier est sauvé.\nVous pouvez sélectionner une action à effectuer.",
  66. "Sauvegarde",
  67. MessageBoxIcon.Information
  68. );
  69. }
  70. }
  71.  
  72.  
  73. private System.Data.DataTable getDGVDataTable()
  74. {
  75. DataTable dataTable = new DataTable(PrintTitle);
  76. foreach (DataGridViewColumn dgvCol in SelectedColumns)
  77. {
  78. dataTable.Columns.Add(dgvCol.HeaderText);
  79. }
  80. foreach (DataGridViewRow dgvRow in dgv.Rows)
  81. {
  82. dataTable.Rows.Add();
  83. int rowIndex = dataTable.Rows.Count -1;
  84. int colIndex = 0;
  85. foreach (DataGridViewCell dgvCell in dgvRow.Cells)
  86. {
  87. if (!SelectedColumns.Contains(dgvCell.OwningColumn))
  88. continue;
  89. dataTable.Rows[rowIndex][colIndex++] = dgvCell.EditedFormattedValue;
  90. }
  91. }
  92. return dataTable;
  93. }
  94. }
  95. }

Structure et Fichiers du projet

Afficher/masquer...


Répertoires contenus dans /var/www/bin/sniplets/bibliobrol/broldev/src/view/utils/dgvFactory/ 
IcôneNomTailleModification
Pas de sous-répertoires.
IcôneNomTailleModification
| _ Répertoire parent0 octets1719954917 02/07/2024 23:15:17
Fichiers contenus dans /var/www/bin/sniplets/bibliobrol/broldev/src/view/utils/dgvFactory/ 
IcôneNomTailleModificationAction
IcôneNomTailleModificationAction
Afficher le fichier .cs|.csHtmlDgv.cs5.03 Ko31/10/2018 18:33:22-refusé-
Afficher le fichier .cs|.csExcelDgv.cs18.77 Ko31/10/2018 18:33:22-refusé-
Afficher le fichier .cs|.csXMLDgv.cs3.02 Ko31/10/2018 18:33:23-refusé-
Afficher le fichier .cs|.csCSVDgv.cs5.02 Ko31/10/2018 18:33:22-refusé-
Afficher le fichier .cs|.csPrintDgv.cs18.02 Ko31/10/2018 18:33:23-refusé-
Afficher le fichier .cs|.csIDgv.cs271 octets31/10/2018 18:33:23-refusé-
Afficher le fichier .cs|.csTextDgv.cs4.02 Ko31/10/2018 18:33:23-refusé-
Afficher le fichier .cs|.csAbstractDgv.cs3.46 Ko31/10/2018 18:33:22-refusé-

Utilisation de l'explorateur de code

  • Navigation :
    • Un clic sur une icône de répertoire ouvre ce répertoire pour en afficher les fichiers.
    • Lorsque le répertoire en cours ne contient pas de sous-répertoires il est possible de remonter vers le répertoire parent.
    • La structure de répertoires en treetable (tableau en forme d'arborescence) n'est plus possibledans cette version.
    • Un clic sur une icône de fichier ouvre ce fichier pour en afficher le code avec la coloration syntaxique adaptée en fonction du langage principal utilisé dans le fichier.
  • Affichage :
    • Il est possible de trier les répertoires ou les fichiers selon certains critères (nom, taille, date).
  • Actions :
    • Les actions possible sur les fichiers dépendent de vos droits d'utilisateur sur le site. Veuillez activer le mode utilisateur pour activer les actions.

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 16/10/2009, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/cs-broldev-source-rf-view/utils/dgvFactory/XMLDgv.cs.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.