0% found this document useful (0 votes)
14 views26 pages

Create Macros and Manage Data in LibreOffice

The document provides detailed instructions on using LibreOffice Calc and Base to perform various tasks, including creating macros for calculating the circumference of a circle, inserting hyperlinks, adding comments, and managing a database for a hostel. It outlines steps for creating tables, establishing relationships between them, and generating queries, forms, and reports. Each section includes specific actions to be taken within the software to achieve the desired outcomes.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views26 pages

Create Macros and Manage Data in LibreOffice

The document provides detailed instructions on using LibreOffice Calc and Base to perform various tasks, including creating macros for calculating the circumference of a circle, inserting hyperlinks, adding comments, and managing a database for a hostel. It outlines steps for creating tables, establishing relationships between them, and generating queries, forms, and reports. Each section includes specific actions to be taken within the software to achieve the desired outcomes.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

8) Use macros to create a function for calculating circumference of a

circle. (Note pass r as argument in the formula, circumference=2*3.14*r)

Steps:-
1) Open LibreOffice Calc
• Create a new blank spreadsheet

2) Open Macro Editor


• Click on Tools→ Macros → Organize Macros → LibreOffice Basic.
3) Create a New Module:-
• Under My Macros, Select Standard.
• Click New.
• Name the Module as ‘Circle’
• Click OK

4) Write the Macro Function:-


In the editor window type the following code:-

5) Save the Macro:-


• Click save
• Close the Macro Editor
6) Use the Macro:-
• Enter the radius in Cell A1(Example:17)
• Use the formula by typing it another cell [=circumference(A1)]

7) Run the Macro:-


Press Enter
The result will appear in the formula cell
9) Create a hyperlink of any document in your spreadsheet. (Page 123)

Step 1. Open the required spreadsheet (Results XB) file in


LibreOffice Calc.

Step 2. Go to the Menu Bar and select Insert →


Hyperlink. The Hyperlink dialog box will open.
Step 3. In the left panel of the Hyperlink dialog box, choose
Document. Click Browse next to the Path field and select the
desired spreadsheet file (for example, Result-X-A).

Step 4. Click the Target button to choose a specific location


within the selected document.
The Target in Document window allows you to select sheets, tables,
frames, images, or headings.
Select the sheet named Result XB.

Step 5. Click Apply and then Close to exit the Target in Document
window.
Step 6. In the Text box, enter the text that will act as the
hyperlink. (Type Result-X-A.)

Step 7. Click Apply and then Close to confirm the hyperlink and
exit the Hyperlink dialog box.
Step 8. The text Result-X-A is now displayed as a hyperlink in the
spreadsheet.

Step 9. To open the linked sheet, hold down the Ctrl key and click
on the hyperlinked text Result-X-A.
The linked sheet will open in a new window.
10) Add and edit any comments on your PT2 marks. (Page number:
134)
Step 1. Select the cell in which the comment needs to be
added. From the Menu Bar, choose Insert → Comment. A
comment box will appear.
Step 2. Type the required text in the comment box (for
example, “Needs to be 23”). Once the comment is entered, a
small colored dot appears in the upper corner of the cell,
indicating that a comment (also called a note or suggestion) has
been added. Viewing, Editing, and deleting Comments.

Step 3. After a comment is inserted, it can be viewed,


edited, or removed. Right-click on the cell containing the
comment to display the available options.
Step 4. Click Edit Comment to make changes to the existing
comment. The comment box will open again for editing.

Step 5. Click Delete Comment to completely remove the


comment from the cell.

Step 6. Click Show Comment to display the comment. If the


comment is already visible, this option changes to Hide
Comment, indicating that the comment can be hidden again.
11) Use a wizard to create a personal table on plants with any five
fields of your choice. Enter 6 records in it. (Page 162)

Step 1. Open LibreOffice Base and open an existing database file.

Step 2. Now we need to go to the **Tasks Pane** and click on


**Use Wizard to Create Table**. This is where we start making our
table.
When you do this the **Table Wizard** dialog box will show up.

Step 3. In the Table Wizard, under Categories, select **Personal


Tables**.
Step 4. Select an appropriate sample table.

In this example, choose **Plant** from the Sample Tables list.

Step 5. Now you will see the list of fields, in the **Available
Fields** box. Highlight any five required fields and then use the
**>** button to push them to the **Selected Fields** box.
The fields that I have chosen
are: PlantID
CommonName
Species
DatePlanted
TemperaturePreference
Step 6. Click **Next**. Perform mapping with suitable data types
and formats for each selected field.
Step 7. Click **Next** again. Set **PlantID** as the **Primary
Key**.

Step 8. Click **Next**. Under the above dialogue box, choose


**Insert data immediately**, then click **Finish**.
Step 9. Clicking **Finish** opens the table in **Datasheet View**.

Step 10. Insert six records into the **Plant** table using the
chosen fields.
12) Uzair manages a boy’s hostel in an engineering college. He wants
to manage the records of the people staying in his hostel by creating a
database using design view with the following tables and also set a
relationship between the tables. (Page 179)
Step A: Creating a New
Database Step 1. Open
LibreOffice Base

Step 2. Select create a new database and click Next.

Step 3. Choose yes, register the database for me and click


Finish. Step 4. Save the database with the name
Hostel_Management.

Step B: Creating Tables Using


Design View
Table 1: Student_Details
Step 5. In the database window, click on
Tables. Step 6. Select Create Table in
Design View.
Step 7. Enter the following fields with suitable
data types: Student_Id
Name
DOB
Course
Mobile
Father’s_Name
Contact_No_Guardian
Step 8. Set Student_Id as the Primary Key.

Step 9. Save the table with the name Student_Details.

Table 2: Room_Details
Step 10. Again choose Create Table in Design View.
Step 11. Enter the following fields with appropriate data
types: Room_No
Floor (First / Second /
Third) Student_Id
DOO (Date of Occupancy)
Monthly_Rent
Step 12. Set Room_No as the Primary Key

Step 13. Save the table as Room_Details.

Creating a Relationship between Tables


The database contains two tables:
Student_Details
Room_Details.
The common field in both tables is Student_Id. In
Student_Details, Student_Id is the Primary Key. In Room_Details,
Student_Id acts as a Foreign Key.
Steps to Establish the Relationship
Step 14. From the Menu Bar, select Tools → Relationships.

Step 15. The Add Tables dialog box appears.

Step 16. Select the Student_Details table and click


Add. Step 17. Select the Room_Details table and
click Add.
Step 18. Click Close to exit the Add Tables dialog box.
Step 19. Drag the Student_Id field from the Student_Details
table and drop it onto the Student_Id field in the Room_Details
table.
Step 20. A line connecting the two tables appears, confirming
that the relationship has been created.

Conclusion
A database named Hostel_Management has been successfully
created in LibreOffice Base. Two tables—Student_Details and
Room_Details—were designed using Design View, and a
relationship was established between them using the
common field Student_Id.
13) Create a query using the design view for the above two tables
to display the following information

Step 1. Click on the Queries icon in the Objects Pane of the


Database window.

Step 2. In the Tasks Pane, click on Create Query in Design View.


The Query Design Window opens.

The Add Table or Query dialog box appears in the center of the

window Step 3. Select the required tables from the list and click

on the Add button.


The selected table is added to the Tables Pane at the top of the
Query Design window.

Step 4. Click on the Close button to close the Add Table or Query
dialog box. Both the Student Details and Room Details tables are
now visible in the Tables Pane, as shown

Step 6. The next step is to select the required fields for the
query. \ To display the desired information:

From the Student Details table, double-click on Name and Course.

From the Room Details table, double-click on Room No, DOO,


Monthly Rent.

The selected fields appear in the Design Grid located in the lower
part of the Query Design window, as shown
Step 7. By default, the query result is not sorted. To sort the
records in either Ascending or Descending order, use the Sort row
in the Design Grid.

To display the records in alphabetical order of Name, select


Ascending from the drop-down list in the Sort row under the Event
Name column.

Step 8. After designing the query, click on the Run Query button
on the toolbar or press the F5 key.
The query result is displayed in the Tables Pane area, as shown

Step 9. Click on the Save button to save the query.


14) Create a form using Wizard for the table you created in question
11 and enter 2 more records through form.
Step 1. Open your existing database.
Step 2. On the left pane, click on the forms button.
Step 3. Use the Form Wizard, Click Use Wizard to Create Form.

Step 4. Select the table or query to base your form on

Step 5. Choose the fields to include.


Step 6. Decide on a layout (e.g., columnar or table format).

Step 7. Apply a style and name your form.


Adding new records:

A new record is created. Enter any required information

Similarly, create the 2nd record


15) Create a report using Wizard for the table you created in
question 11.
Step 1. Open LibreOffice Base and open the database containing
the Plant table.
Step 2. Click on the Reports icon in the Objects Pane.
Step 3. In the Tasks Pane, click on Use Wizard to Create Report.

Step 4. From the Tables or Queries drop-down list, select the Plant
table.
Step 5. Select the required fields from the Available Fields list
and move them to the Fields in Report list

Step 6. Click on the Next button. Choose the grouping options if


required. Step 7. Click Next again. Select the required sorting
order if needed.
Step 8. Click Next. Choose the layout and orientation of the report.
Step 9. Click Next. Enter a suitable title for the report, such as
Plant_Report. Step 10. Select Create report now and click on the
Finish button.

Step 11. Thus, a report of plants is created.

You might also like