Report API/he
מנשק Simple Document API הוא מנשק API שנועד לדוחות (מנשק תכנות יישומים ) כדי לשרת כותבי תוספים עבור גרמפס |
מנשק API של מסמך פשוט מיועד להצגה קלה של הנתונים וניתן להשתמש בו עם מנשק API לגישה קלה.
|
תוכן מאמר זה לא שלם או שהוא 'בדל' שמשמש כמציין מיקום. |
קיימים בגרמפס חמישה סוגים שונים של דוחות:
- דוח מילולי
- דוח חזותי
- תרשים
- ספר דוחות
- עמודי מרשתת
מתוך הסוגים שלעיל, רק דוחות מילוליים, דוחות חזותיים ותרשימים משתמשים ב־API דוחות (מסמך), מכיוון שדוחות מרשתת כותבים את הפלט ישירות לקבצים, בעוד שספר דוחות הוא פשוט שילוב של דוחות מילוליים ודוחות חזותיים שמקובצים יחדיו כספר דוחות.
API משותף
לעת עתה שילוב רכיבים מילוליים וחזותיים בתוך מסמך אחד לא נתמך (לתוכניות עתידיות נא עיין בעיצוב מחדש של API דוחות), לכן דוחות מילוליים וחזותיים מיושמים באמצעות מנשקי API נפרדים, אם כי יש להם מרכיב משותף. מרכיב משותף זה מיושם באמצעות מחלקת BaseDoc, שמכיל בין היתר ראש וסיומת עמוד של מסמכים בסיסיים , ושיטות טיפול בגיליון סגנונות. המנשק מאחסן גם את התיאור הממשי של העמוד (גיליון נייר בדפוס).
הערה! את שיטות BaseDoc.open ו-BaseDoc.close יש ליישם על ידי מחוללי מסמכים מחלקה משנית. |
עימוד
התיאור ומאפייני הדף אליו יועבר תצוג כל דוח באשר הוא, מאוחסן על ידי אדגם Classyle. אדגם זה זמין דרך תכונת מחלקה basedoc.paper_style. סוג ה־PaperStyle שנבחר מועבר למחולל המסמכים בעת האתחול, ומטופל על ידי מסגרת פתוח הדוחות.רכיב PaperStyle מכיל מידע על גודל הדף (מחלקה PaperSize לדוגמה), גודל השוליים וכיוון הדף. כדי לקבל את הערכים יש להשתמש בשיטות העזר המתאימות. כדי לקבל את תשקיל האזור בו ניתן להשתמש בדף (דף ללא שוליים) אפשר גם להשתמש ב־שיטות נוחות .PaperStyle.get_usable_width PaperStyle.get_usable_width ו־PaperStyle.get_usable_height. רוחב וגובה מתקבלים תמיד לפי כיוון הנייר (לאורך או לרוחב), ולכן הרוחב הוא תמיד הממד האופקי והגובה הוא תמיד הממד האנכי.
לדוחות מלל אין צורך לדאוג למאפייני דף, שכן מחולל המסמכים (או המשקף החיצוני) מספרר את הדוח בהתאם לאותם מאפיינים. מאידך, דוחות חזותיים כן נדרשים להתחשב במאפייני הדף בעת יצירת רכיבים חזותיים, כלומר הם לא אמורים לגלוש לשוליים.
מקור מערכת הצירים הוא תמיד הפינה השמאלית העליונה של האזור בו ניתן להשתמש.
מסמך מילולי API
The specification of the Textdoc API is here
The interface for adding media objects is as follows:
add_media_object(name, align, w_cm, h_cm, alt='', style_name=None, crop=None)[source]
Add a photo of the specified width (in centimeters).
Parameters:
name – filename of the image to add
align – alignment of the image. Valid values are ‘left’, ‘right’, ‘center’, and ‘single’
w_cm – width in centimeters
h_cm – height in centimeters
alt – an alternative text to use. Useful for eg html reports
style_name – style to use for captions
crop – image cropping parameters
Note that because of the structure of these documents, Images are only allowed as children (i.e. following) Document or Cell.
This interface is used in the following reports:
| Report | Built-in | align | style_name | how called |
|---|---|---|---|---|
| Detailed Ancestral Report | Built-in | right | DDR-Caption | via gen/plug/report/utils.py |
| Detailed Descendant Report | Built-in | right | DDR-Caption | via gen/plug/report/utils.py |
| Individual Complete Report | Built-in | right | None | direct |
| Book (Title Page) | Built-in | center | None | direct |
| Person Everything | Addon | single | PE-Level%d | direct |
None of the reports use 'alt'. It is understood (from looking at the code in odfdoc.py) that left and right alignment should cause the text to wrap around the media object, while for single alignment, there should be no text on either side of the media object.
Since style_name should be used as the style for the caption (i.e. the alt string) it should also be used for the image itself. Otherwise the caption would not be below the picture.
As at December 2014, output appears as follows:
| Format | right | center | single |
|---|---|---|---|
| HTML | OK Picture on right, text wrapped round it | ? | Picture on left margin, text not wrapped |
| RTF | Picture on left margin, text not wrapped | ? | OK Picture aligned with previous paragraph, text not wrapped |
| ODF | OK Picture on right, text wrapped round it | ? | Picture centred, text not wrapped |
| Picture on right, text not wrapped | ? | Picture on left margin, text not wrapped |
מסמך תרשים API
|
This article's content is incomplete or a placeholder stub. |
