Suivez et participez au développement du nouvel OpenCellar : PLOC.co
> Open Cellar for Windows
> Help Center
> FAQ
> Download Center
> Enter the Forum
> Version history
> Developers resources
> Open Cellar for Mobile
> Help Center
> FAQ
> Download Center
> Enter the Forum
> Version history
> Open Cellar for Mac/Linux
> Help Center
> FAQ
> Download Center
> Enter the Forum
> Version history
> Developers resources
> My Account
> My Live services
> My pages
> My library
> My published wines
> My labels
> My posted messages
> Write a page
> Open Cellar Forum Index
> Windows Forum
> Mac/Linux Forum
> Mobile Forum
> Search for and import wines
> Search for labels
> Compare prices (Sniffer)
Search:
> Search with all engines
> Search in forums
> Search in personal pages
> Search on open-cellar.com
> Search in wine cards
> Search in labels
> Search in price comparison tool (Sniffer)
Welcome (
connect
-
create an account
)
Home
»
The forum
»
Open Cellar Home Edition (Windows)
Nuage de tags
Open Cellar
Scripts
Etiquette
PPP
Cellar book
Mac
Vista
Synchronisation
Excel export
vinoXml
usb
sniffer
backup
import
printing
chardonnet
palm
statistics
Linux
Emplacement sur deux lignes
02/01/2008
Reply
Emplacement sur deux lignes
bugmenot314
6 posts
Bonjour !
Lors de l'édition de mon livre de cave, si les bouteilles sont sur plusieurs emplacements, cela dépasse du cadre.
Peut-on faire en sorte que s'il y a plusieurs emplacements, ceux-ci soient écrits sur deux lignes ? voici mon code :
App.Animate(AnimationType.Work, true);
App.SetCursor(true);
//
// Modifiez ici le titre du report
//
string reportName = "Liste des vins";
//
// Creation entete report
//
ReportTable rt = new ReportTable(reportName);
//
// Couleur
//
ReportColumn rcColor = rt.NewColumn("Couleur");
rcColor.Size = 45;
//
// Région
//
ReportColumn rcArea = rt.NewColumn("Région");
rcArea.Size = 75;
//
// Appellation
//
ReportColumn rcApp = rt.NewColumn("Appellation");
rcApp.Size = 120;
// Nom
//
ReportColumn rcProd = rt.NewColumn("Producteur");
rcProd.Size = 150;
// Nom
//
ReportColumn rcName = rt.NewColumn("Nom");
rcName.Size = 135;
//
// Classement
//
ReportColumn rcCl = rt.NewColumn("Classement");
rcCl.Size = 50;
//
// Année
//
ReportColumn rcYear = rt.NewColumn("Année");
rcYear.Size = 35;
rcYear.ContentAlignment = ReportContentAlignment.Right;
rcYear.DataType = ReportColumnType.Numeric;
//
// Nombre bouteilles
//
ReportColumn rcBottles = rt.NewColumn("Qté");
rcBottles.Size = 25;
rcBottles.ContentAlignment = ReportContentAlignment.Right;
rcBottles.DataType = ReportColumnType.Numeric;
//
// Emplacement
//
ReportColumn rcEmpl = rt.NewColumn("Empl.");
rcEmpl.Size = 150;
//
// Alimentation de la source
//
ObjectCollection wines = App.ActiveCellar.GetCollection((ushort)ObjectType.Wine);
for (int i = 0; i < wines.Count; i++)
{
Wine wine = (Wine)wines[i];
ReportRow row = rt.NewRow();
row[1] = wine.Area.Name;
row[2] = wine.Appellation.Name;
row[3] = wine.Owner.Name;
row[5] = wine.Classification.Name;
row[4] = wine.Name;
row[0] = "---";
if(wine.WineColor == ColorType.Red)
{
row[0] = "Rouge";
}
else if(wine.WineColor == ColorType.White)
{
row[0] = "Blanc";
}
else if(wine.WineColor == ColorType.Rosy)
{
row[0] = "Rosé";
}
else if(wine.WineColor == ColorType.Yellow)
{
row[0] = "Champagne";
}
else if(wine.WineColor == ColorType.LiqueurLike)
{
row[0] = "Liquoreux";
}
else if(wine.WineColor == ColorType.Misc)
{
row[0] = "Autre";
}
if(wine.Year != 0)
{
row[6] = wine.Year.ToString();
}
//
// Gestion manuelle
//
if(wine.ManualManagement)
{
row[7] = wine.Bottles.ToString();
}
else
{
row[7] = wine.RackItems.Count.ToString();
}
row[8] = wine.Grid_RackItems;
}
//
// Tri des elements
//
rt.Sort("0-0;1-0;3-0;4-0;5-1");
//
// Génération
//
System.Collections.ArrayList list = new System.Collections.ArrayList();
list.Add(rt);
IReport report = App.ReportEngine.GetSystemReport(PredefinedReport.Grid);
string destFileName = App.Path + "Cache\\UserWinesGrid.pdf";
bool success = false;
try
{
report.Create(list, destFileName);
success = true;
}
catch(Exception ex)
{
MessageBox.Show("Erreur (1)");
}
//
// Affichage du report
//
if(success)
{
IShellWindow shellWindow = (IShellWindow)App.GetWindow(WindowType.Shell, null);
if(shellWindow != null)
{
shellWindow.Start(destFileName);
}
}
App.SetCursor(false);
App.StopAnimate();
02/01/2008
Reply
Re : Emplacement sur deux lignes
Administrateur
3099 posts
Bonsoir,
Voici le script, par contre j'ai du supprimé le tri.
App.Animate(AnimationType.Work, true); App.SetCursor(true); // // Modifiez ici le titre du report // string reportName = "Liste des vins"; // // Creation entete report // ReportTable rt = new ReportTable(reportName); // // Couleur // ReportColumn rcColor = rt.NewColumn("Couleur"); rcColor.Size = 45; // // Région // ReportColumn rcArea = rt.NewColumn("Région"); rcArea.Size = 75; // // Appellation // ReportColumn rcApp = rt.NewColumn("Appellation"); rcApp.Size = 120; // Nom // ReportColumn rcProd = rt.NewColumn("Producteur"); rcProd.Size = 150; // Nom // ReportColumn rcName = rt.NewColumn("Nom"); rcName.Size = 135; // // Classement // ReportColumn rcCl = rt.NewColumn("Classement"); rcCl.Size = 50; // // Année // ReportColumn rcYear = rt.NewColumn("Année"); rcYear.Size = 35; rcYear.ContentAlignment = ReportContentAlignment.Right; rcYear.DataType = ReportColumnType.Numeric; // // Nombre bouteilles // ReportColumn rcBottles = rt.NewColumn("Qté"); rcBottles.Size = 25; rcBottles.ContentAlignment = ReportContentAlignment.Right; rcBottles.DataType = ReportColumnType.Numeric; // // Emplacement // ReportColumn rcEmpl = rt.NewColumn("Empl."); rcEmpl.Size = 150; // // Alimentation de la source // ObjectCollection wines = App.ActiveCellar.GetCollection((ushort)ObjectType.Wine); for (int i = 0; i < wines.Count; i++) { Wine wine = (Wine)wines[i]; ReportRow row = rt.NewRow(); row[1] = wine.Area.Name; row[2] = wine.Appellation.Name; row[3] = wine.Owner.Name; row[5] = wine.Classification.Name; row[4] = wine.Name; row[0] = "---"; if(wine.WineColor == ColorType.Red) { row[0] = "Rouge"; } else if(wine.WineColor == ColorType.White) { row[0] = "Blanc"; } else if(wine.WineColor == ColorType.Rosy) { row[0] = "Rosé"; } else if(wine.WineColor == ColorType.Yellow) { row[0] = "Champagne"; } else if(wine.WineColor == ColorType.LiqueurLike) { row[0] = "Liquoreux"; } else if(wine.WineColor == ColorType.Misc) { row[0] = "Autre"; } if(wine.Year != 0) { row[6] = wine.Year.ToString(); } // // Gestion manuelle // if(wine.ManualManagement) { row[7] = wine.Bottles.ToString(); } else { row[7] = wine.RackItems.Count.ToString(); } row[8] = wine.Grid_RackItems.Trim(); string tempString = row[8]; int start = 29; if(tempString.Length > start) { ReportRow subrow = rt.NewRow(); while(row[8][start] != ' ') { start--; } row[8] = row[8].Substring(0, start); subrow[8] = tempString.Substring(start).Trim(); } } // // Tri des elements // // rt.Sort("0-0;1-0"); // // Génération // System.Collections.ArrayList list = new System.Collections.ArrayList(); list.Add(rt); IReport report = App.ReportEngine.GetSystemReport(PredefinedReport.Grid); string destFileName = App.Path + "Cache\\UserWinesGrid.pdf"; bool success = false; try { report.Create(list, destFileName); success = true; } catch(Exception ex) { MessageBox.Show("Erreur (1)"); } // // Affichage du report // if(success) { IShellWindow shellWindow = (IShellWindow)App.GetWindow(WindowType.Shell, null); if(shellWindow != null) { shellWindow.Start(destFileName); } } App.SetCursor(false); App.StopAnimate();
Matthieu
© 2006-2014
Matthieu DUCROCQ
- All rights reserved - Last update: january 2014 |
|
Support Open Cellar
|
Contact
|
About