IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

OpenOffice & LibreOffice Discussion :

[macro] Sélecteur de Date [LibreOffice][Tableur]


Sujet :

OpenOffice & LibreOffice

  1. #1
    Membre régulier
    Avatar de madvic
    Homme Profil pro
    Inscrit en
    Mai 2003
    Messages
    101
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Deux Sèvres (Poitou Charente)

    Informations forums :
    Inscription : Mai 2003
    Messages : 101
    Points : 92
    Points
    92
    Par défaut [macro] Sélecteur de Date
    Bonjour à tous,

    Voilà, je rencontre de grosse difficultées avec le sélecteur de date de Calc.

    Nom : 1.PNG
Affichages : 705
Taille : 1,2 Ko

    Je souhaite récupérer la données choisie et affecter des dates par défaut (DateMin, DateMax, DateCourante)
    La date est stockée dans un Varient avec des champ spécifique (Day, Month, Year)

    Nom : 2.PNG
Affichages : 822
Taille : 57,6 Ko

    Première remarque, pour la liste de choix, on récupère la données avec la propriété .SelectedValue, pourquoi n’est ce pas le cas avec cet objet..? Non, trop simple, autant mettre un champ nommé différemment.

    Donc sinon, d’après la FAQ
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
     oDialog1.getControl("DateField1").Date = 20070101 'AAAAMMJJ 
     oDialog1.getControl("DateField1").Model.DateMin = 20070101 
     oDialog1.getControl("DateField1").Model.DateMax = 20071231
    mais là, c’est une boite de dialog, moi je suis sur le tableur. mais j’essaye quand même :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    fSaisie = thisComponent.Sheets.getByName("saisie")
    formDateSaisie = fSaisie.DrawPage.Forms.getByName("saisieForm").getByName("dateSaisie")
    formDateSaisie.Date = 20141103
    Boum, ca plante :
    Nom : 3.PNG
Affichages : 686
Taille : 5,6 Ko

    Alors j’essaye la méthode setPropertyValue
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    formDateSaisie.setPropertyValue("Date", AUJOURDHUI() )
    Nom : 4.PNG
Affichages : 715
Taille : 10,0 Ko


    J’ai essayé aussi Vendredi en utilisant un objet Property .Name / .Value mais rien de mieux….

  2. #2
    Rédacteur

    Avatar de zoom61
    Homme Profil pro
    ...
    Inscrit en
    Janvier 2005
    Messages
    9 429
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Vienne (Limousin)

    Informations professionnelles :
    Activité : ...
    Secteur : Industrie

    Informations forums :
    Inscription : Janvier 2005
    Messages : 9 429
    Points : 58 612
    Points
    58 612
    Billets dans le blog
    11
    Par défaut
    Salut,

    Pour une date, il faut mettre :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    DateSerial (2014, 11, 3)
    N'oubliez pas le Tag afin de faciliter la recherche, et en votant cela permet de mieux la cibler.

    Je ne réponds pas aux messages privés s'ils sont liés à une question technique

  3. #3
    Membre régulier
    Avatar de madvic
    Homme Profil pro
    Inscrit en
    Mai 2003
    Messages
    101
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Deux Sèvres (Poitou Charente)

    Informations forums :
    Inscription : Mai 2003
    Messages : 101
    Points : 92
    Points
    92
    Par défaut
    j'ai essayé :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    		formDateSaisie.Date = DateSerial (2014, 11, 3)
    		formDateSaisie.setPropertyValue("Date", DateSerial (2014, 11, 3) )
    Aucun des deux ne fonctionne...

  4. #4
    Rédacteur

    Avatar de zoom61
    Homme Profil pro
    ...
    Inscrit en
    Janvier 2005
    Messages
    9 429
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Vienne (Limousin)

    Informations professionnelles :
    Activité : ...
    Secteur : Industrie

    Informations forums :
    Inscription : Janvier 2005
    Messages : 9 429
    Points : 58 612
    Points
    58 612
    Billets dans le blog
    11
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    formDateSaisie.Value = DateSerial (2014, 11, 3)
    N'oubliez pas le Tag afin de faciliter la recherche, et en votant cela permet de mieux la cibler.

    Je ne réponds pas aux messages privés s'ils sont liés à une question technique

  5. #5
    Membre régulier
    Avatar de madvic
    Homme Profil pro
    Inscrit en
    Mai 2003
    Messages
    101
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Deux Sèvres (Poitou Charente)

    Informations forums :
    Inscription : Mai 2003
    Messages : 101
    Points : 92
    Points
    92
    Par défaut
    Non plus, la propriété value n'existe pas !
    Il y a bien la propriété .Text, mais si je modifie celle-ci, le champ Date, ne bouge pas. (getCurrentvalue())

    Voici la liste des propriétés de Xray :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
     
    Align                     integer                                 1  may be void 
    BackgroundColor           long                              <empty>  may be void 
    Border                    integer                                 2  may be void 
    BorderColor               long                              <empty>  may be void 
    BoundField                object                             <null>  read-only 
    ClassId                   integer                                15  read-only 
    ContextWritingMode        integer                                 4   
    DataField                 string                               ""   
    DataFieldProperty         string                             "Date"  read-only 
    Date                      struct                                     may be void 
    DateFormat                integer                                 7   
    DateMax                   struct                                      
    DateMin                   struct                                      
    DateShowCentury           boolean                           <empty>  may be void 
    DefaultControl            string                              <...>   
    DefaultDate               struct                                     may be void 
    Dropdown                  boolean                              True   
    EnableVisible             boolean                              True   
    Enabled                   boolean                              True   
    EnforceFormat             boolean                              True   
    FontCharWidth             single                                  0   
    FontCharset               integer                                 0   
    FontDescriptor            struct                                      
    FontEmphasisMark          integer                                 0   
    FontFamily                integer                                 0   
    FontHeight                single                                  0   
    FontKerning               boolean                             False   
    FontName                  string                                 ""   
    FontOrientation           single                                  0   
    FontPitch                 integer                                 0   
    FontRelief                integer                                 0   
    FontSlant                 integer                                 3   
    FontStrikeout             integer                                 3   
    FontStyleName             string                                 ""   
    FontType                  integer                                 0   
    FontUnderline             integer                                 4   
    FontWeight                single                                  0   
    FontWidth                 integer                                 0   
    FontWordLineMode          boolean                             False   
    FormatKey                 long                                  122   
    FormatsSupplier           object                                     read-only 
    GenerateVbaEvents         boolean                             False   
    HelpText                  string                                 ""   
    HelpURL                   string                                 ""   
    HideInactiveSelection     boolean                             False   
    InputRequired             boolean                             False   
    LabelControl              object                            <empty>  may be void 
    MouseWheelBehavior        integer                                 0   
    Name                      string                       "dateSaisie"   
    NativeWidgetLook          boolean                             False   
    Printable                 boolean                              True   
    ReadOnly                  boolean                             False   
    Repeat                    boolean                             False   
    RepeatDelay               long                                   50   
    Spin                      boolean                             False   
    StrictFormat              boolean                              True   
    TabIndex                  integer                                 0   
    Tabstop                   boolean                           <empty>  may be void 
    Tag                       string                                 ""   
    Text                      string                       "18/10/2014"   
    TextColor                 long                              <empty>  may be void 
    TextLineColor             long                              <empty>  may be void 
    VerticalAlign             integer                                 1  may be void 
    WritingMode               integer                                 4   
    PropertySetInfo           object                                     (get?), read-only 
    PropertyValues            []struct                                   (get,set) 
    PropertyToDefault         string                                     (set), write-only 
    Parent                    object                                     (get,set) 
    ValueBinding              object                             <null>  (get,set) 
    Validator                 object                             <null>  (get,set) 
    CurrentValue              variant                                    (get), read-only 
    ServiceName               string                              <...>  (get), read-only 
    ImplementationName        string                              <...>  (get), read-only 
    SupportedServiceNames     []string                                   (get), read-only 
    Types                     []type                                     (get), read-only 
    ImplementationId          []byte                                     (get), read-only 
    Delegator                 object                                     (set), write-only

  6. #6
    Rédacteur

    Avatar de zoom61
    Homme Profil pro
    ...
    Inscrit en
    Janvier 2005
    Messages
    9 429
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Vienne (Limousin)

    Informations professionnelles :
    Activité : ...
    Secteur : Industrie

    Informations forums :
    Inscription : Janvier 2005
    Messages : 9 429
    Points : 58 612
    Points
    58 612
    Billets dans le blog
    11
    Par défaut
    Là, je ne vois pas
    N'oubliez pas le Tag afin de faciliter la recherche, et en votant cela permet de mieux la cibler.

    Je ne réponds pas aux messages privés s'ils sont liés à une question technique

  7. #7
    Membre régulier
    Avatar de madvic
    Homme Profil pro
    Inscrit en
    Mai 2003
    Messages
    101
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Deux Sèvres (Poitou Charente)

    Informations forums :
    Inscription : Mai 2003
    Messages : 101
    Points : 92
    Points
    92
    Par défaut
    Oouuuuuuuuuuffffff Trouvé


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    		max = new com.sun.star.util.Date
    		max.Day = Day(AUJOURDHUI())
    		max.Month = Month(AUJOURDHUI())
    		max.Year = Year(AUJOURDHUI())
    		formDateSaisie.setPropertyValue("DateMax", max )
    		min = new com.sun.star.util.Date
    		min.Day = 1
    		min.Month = 1
    		min.Year = 1986
    		formDateSaisie.setPropertyValue("DateMin", min )
    		formDateSaisie.setPropertyValue("Date", max )
    Bon ben j'ai plus qu'a ajouté cela à la FAQ... :-b
    Franchement quelle galère... 1 journée de perdue

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [AC-2007] Sélecteur de dates (calendrier)
    Par Massanga dans le forum IHM
    Réponses: 15
    Dernier message: 30/03/2020, 09h25
  2. [Macro] manipulation de dates
    Par jobvince dans le forum Macro
    Réponses: 2
    Dernier message: 21/08/2008, 09h13
  3. Macro conversion de date
    Par malabarbe dans le forum Macros et VBA Excel
    Réponses: 3
    Dernier message: 28/06/2008, 12h30
  4. Débutant - Macro recherche de date
    Par joums dans le forum Macros et VBA Excel
    Réponses: 12
    Dernier message: 18/12/2007, 23h06
  5. [Q] VB Excel: Macros calcul de date jours ouvrés
    Par naouara17 dans le forum Macros et VBA Excel
    Réponses: 2
    Dernier message: 04/05/2007, 13h59

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo