Answer the question
In order to leave comments, you need to log in
How to make a program to fill data in Word?
Please help in resolving the issue of creating a program whose task is to fill in two or three different types of questionnaires ---> generate the generated file in Word or PDF format ---> Send the file to a specific postal address .
The purpose is as follows:
1. A drop-down list appears like:
Answer the question
In order to leave comments, you need to log in
It is not clear why the " Programming
" tag was removed from the question. It turns out the answer in some way will be offtopic.
Now, in essence:
I don’t know if there is such an opportunity in Word , but if there is, then it would be better (faster) to use it.
But if it is the program that is needed, then I would start by drawing up a technical specification (technical task), which would contain a detailed description of the required functionality.
So far, the description in the question is rather vague, but here is a sketch that I quickly wrote in a couple of hours in the F# programming language:
Note : Perhaps F# is not the best choice for this task, but since I use it for my personal programs, I also quote German
1. The main objects are defined (Student, Teacher, Entrant) for which the characteristics to be filled in are listed as properties:
module Model
type Student = {
Name : string
Surname : string
LastName : string
Phone : string
Faculty : string
}
[<RequireQualifiedAccess>]
type AccountType =
| Student of Student
| Enrollee of Enrollee
| Teacher of Teacher
[<RequireQualifiedAccess>]
module Defaults =
let student:Student = {
Name = ""
Surname = ""
LastName = ""
Phone = ""
Faculty = ""
}
[<RequireQualifiedAccess>]
module PdfReport
open Model
open PdfSharp.Drawing
open SharpLayout
let private defaultSettings =
PageSettings(
TopMargin=Util.Cm(1.2),
BottomMargin=Util.Cm(1.0),
LeftMargin=Util.Cm(2.0),
RightMargin=Util.Cm(1.0))
let private createReportForTeacher teacher =
let document = Document()
let section = document.Add(Section(defaultSettings))
let font =
Font("Times New Roman", 10.0, XFontStyle.Regular, XPdfFontOptions.UnicodeDefault)
|> Option
section.Add(Paragraph().Add("Информация об преподователе", font.Value).Alignment(HorizontalAlign.Center.AsOption().ToNullable())) |> ignore
let table = section.AddTable().Font font
let c1 = table.AddColumn(Util.Px(600.0))
let c2 = table.AddColumn(Util.Px(600.0))
let r1 = table.AddRow()
let r2 = table.AddRow()
let r3 = table.AddRow()
let r4 = table.AddRow()
let r5 = table.AddRow()
r1.[c1].Add(Paragraph().Add("Имя:")) |> ignore
r1.[c2].Add(Paragraph().Add(teacher.Name)) |> ignore
r2.[c1].Add(Paragraph().Add("Фамилия:")) |> ignore
r2.[c2].Add(Paragraph().Add(teacher.LastName)) |> ignore
r3.[c1].Add(Paragraph().Add("Отчество:")) |> ignore
r3.[c2].Add(Paragraph().Add(teacher.Surname)) |> ignore
r4.[c1].Add(Paragraph().Add("Телефон:")) |> ignore
r4.[c2].Add(Paragraph().Add(teacher.Phone)) |> ignore
r5.[c1].Add(Paragraph().Add("Факультет:")) |> ignore
r5.[c2].Add(Paragraph().Add(teacher.Faculty)) |> ignore
document
[<RequireQualifiedAccess>]
type NavMessages =
| Student
| Teacher
| Enrollee
let appComp =
Component.create<AppModel, NavMessages, Messages> [
<@ ctx.Model.Student @> |> Bind.comp (fun m -> m.Student) studentComp fst
<@ ctx.Model.Enrollee @> |> Bind.comp (fun m -> m.Enrollee) enrolleeComp fst
<@ ctx.Model.Teacher @> |> Bind.comp (fun m -> m.Teacher) teacherComp fst
<@ ctx.Model.Menu @> |> Bind.comp (fun m -> m.Menu) menuComponent fst
<@ ctx.SendReport @> |> Bind.cmd
]
let upd (nav : Dispatcher<NavMessages>) message model =
match message with
| Messages.SendReport ->
let v, m =
match model.Menu.Current with
| NavMessages.Enrollee ->
AccountType.Enrollee model.Enrollee, { model with Enrollee = Defaults.enrollee }
| NavMessages.Student ->
AccountType.Student model.Student, { model with Student = Defaults.student }
| NavMessages.Teacher ->
AccountType.Teacher model.Teacher, { model with Teacher = Defaults.teacher }
v
|> PdfReport.createReport
|> PdfReport.saveReport "test.pdf"
|> PdfReport.sendReport
m
| Messages.SetCurrent current ->
current |> nav.Dispatch
{ model with Menu = { model.Menu with Current = current }}
| Messages.UpdateEnrollee msg ->
{ model with Enrollee = EnrolleeComponent.update model.Enrollee msg }
| Messages.UpdateStudent msg ->
{ model with Student = StudentComponent.update model.Student msg }
| Messages.UpdateTeacher msg ->
{ model with Teacher = TeacherComponent.update model.Teacher msg }
open Gjallarhorn.Bindable.Framework
let applicationCore nav =
let navigation = Dispatcher<NavMessages>()
Framework.application init (upd navigation) appComp nav
|> Framework.withNavigation navigation
MS Word, "Mailouts".
100 students / teachers at the same time and let them fill in their data and sendCreate and distribute PDF forms .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question