C#을 사용하여 JSON 마크업에서 설문조사 양식 만들기

설문 조사는 기업이나 조직이 비즈니스를 성장시키기 위한 시장 조사에서 중요한 역할을 합니다. 그들은 설문 조사 양식을 사용하여 고객 피드백, 사용자 리뷰 또는 의견을 수집합니다. 설문 조사 양식에는 일반적으로 사용자 입력을 표시하기 위한 객관식 질문이 포함됩니다. 프로그래밍 방식으로 JSON 마크업에서 설문조사, 퀴즈 및 바로 인쇄할 수 있는 OMR 답안지를 쉽게 생성할 수 있습니다. JSON을 사용하면 프로그래밍 방식으로 구문 분석 및 처리할 수 있는 데이터를 저장하고 전송할 수 있습니다. 이 기사에서는 C#을 사용하여 JSON 마크업에서 설문조사 양식을 만드는 방법을 배웁니다.

이 기사에서는 다음 주제를 다룹니다.

JSON에서 설문 조사 양식을 만드는 C# OMR API

JSON 마크업에서 설문조사 양식을 생성하기 위해 Aspose.OMR for .NET API를 사용할 것입니다. 답안지, 테스트, MCQ 논문, 퀴즈, 피드백 양식, 설문조사 및 투표용지를 디자인, 생성 및 인식할 수 있습니다. API의 DLL을 다운로드하거나 NuGet을 사용하여 설치하십시오.

PM> Install-Package Aspose.OMR

C#을 사용하여 JSON 마크업에서 OMR 설문조사 양식 만들기

아래 단계에 따라 JSON 마크업에서 설문조사 양식을 만들 수 있습니다.

  • 먼저 OmrEngine 클래스의 인스턴스를 만듭니다.
  • 그런 다음 JSON 마크업 파일 경로를 인수로 사용하여 GenerateJSONTemplate 메서드를 호출합니다.
  • 그 후 GenerationResult 클래스의 객체로 결과를 얻습니다.
  • 마지막으로 Save 메서드를 호출하여 템플릿 이미지와 OMR 템플릿을 저장합니다. 로컬 디스크 폴더의 경로와 템플릿 이름을 인수로 사용합니다.

다음 코드 예제에서는 C#을 사용하여 JSON 마크업에서 OMR 설문 조사 양식 템플릿을 만드는 방법을 보여줍니다.

// 이 코드 예제는 JSON 마크업에서 설문조사 이미지와 OMR을 생성하는 방법을 보여줍니다.
// 템플릿 마크업이 있는 JSON 파일 경로
string markupPath = @"C:\Files\OMR\SimpleSurvey.json";

// OMR 엔진 초기화
OmrEngine engine = new OmrEngine();

// 템플릿 생성
GenerationResult res = engine.GenerateJSONTemplate(markupPath);

// 로컬 디스크에 저장
res.Save(@"C:\Files\OMR\", "SimpleSurvey");
Create OMR Survey Form from JSON Markup using C#

Create OMR Survey Form from JSON Markup using C#

위에서 언급한 코드 예제에서 다음 JSON 템플릿 마크업을 사용했습니다.

{
	"element_type": "template",
	"children": [
		{
			"element_type": "page",
			"children": [
				{
					"name": "Welcome to Sample Survey",
					"element_type": "text",
					"font_style": "bold",
					"font_size": 16,
					"align": "center"
				},
				{
					"element_type": "emptyLine"
				},
				{
					"element_type": "text",
					"name": "February 25, 2022",
					"font_style": "italic",
					"align": "right"
				},
				{
					"element_type": "emptyLine"
				},
				{
					"name": "Section - I",
					"element_type": "text",
					"font_style": "bold",
					"font_size": 14,
					"align": "Left"
				},
				{
					"font_family": "Segoe UI",
					"font_style": "Regular",
					"font_size": 12,
					"align": "Left",
					"answers_string": "(() Yes, indeed! () No",
					"question_text": "Can Aspose.OMR process not only scans, but also photos?\r\n",
					"element_type": "ChoiceBox"
				},
				{
					"font_family": "Segoe UI",
					"font_style": "Regular",
					"font_size": 12,
					"align": "Left",
					"answers_string": "((Yes) Yes, indeed! (No) No",
					"question_text": "Aspose.OMR works with any kind of OMR forms: tests, exams, questionnaires, surveys, etc.\r\n",
					"element_type": "ChoiceBox"
				},
				{
					"font_family": "Segoe UI",
					"font_style": "Regular",
					"font_size": 12,
					"align": "Left",
					"answers_string": "(() Very high quality () High quality\r\n() Average quality () Low quality",
					"question_text": "How would you rate the quality of the product:\r\n",
					"element_type": "ChoiceBox"
				},
				{
					"font_family": "Segoe UI",
					"font_style": "Regular",
					"font_size": 12,
					"align": "Left",
					"answers_string": "(1) (2) (3) (4) (5) (6) (7) (8) (9)",
					"question_text": "How likely is it that you would recommend our company to a friend or colleague?\r\n",
					"element_type": "ChoiceBox"
				},
				{
					"element_type": "emptyLine"
				},
				{
					"children": [
						{
							"name": "Section - II",
							"font_style": "Bold",
							"font_size": 14,
							"align": "Left",
							"element_type": "Text"
						},
						{
							"name": "main_container",
							"children": [
								{
									"name": "main_block",
									"children": [
										{
											"name": "product survey",
											"children": [
												{
													"font_family": "Segoe UI",
													"font_style": "Bold",
													"font_size": 12,
													"row_proportions": [
														60,
														20,
														10,
														10
													],
													"name": "How would you rate your total experience?",
													"children": [
														{
															"name": "Score",
															"header_type": "Amount",
															"element_type": "ScoreHeader"
														},
														{
															"name": "Yes",
															"header_type": "Positive",
															"element_type": "ScoreHeader"
														},
														{
															"name": "No",
															"header_type": "Negative",
															"element_type": "ScoreHeader"
														},
														{
															"Score": 5,
															"element_type": "ScoreAnswer",
															"name": "I am enjoy the product."
														},
														{
															"Score": 10,
															"element_type": "ScoreAnswer",
															"name": "I will recommend it to my friends."
														}
													],
													"element_type": "ScoreQuestion"
												}
											],
											"score_group_type": "Table",
											"element_type": "ScoreGroup"
										}
									],
									"column": 1,
									"element_type": "Block"
								}
							],
							"columns_count": 1,
							"element_type": "Container"
						},
						{
							"element_type": "page",
							"children": [
								{
									"name": "1-st",
									"children": [
										{
											"name": "Process",
											"children": [
												{
													"name": "Process",
													"element_type": "writeIn"
												}
											],
											"element_type": "block"
										}
									],
									"element_type": "container"
								}
							]
						}
					],
					"element_type": "Page"
				}
			]
		}
	]
}

C#을 사용하여 JSON 마크업에서 PDF로 설문조사 생성

위에서 언급한 단계에 따라 생성된 설문조사 양식을 PDF 문서로 저장할 수도 있습니다. 그러나 마지막 단계의 Save 메서드 대신 SaveAsPdf(string folder, string name) 메서드를 호출하기만 하면 됩니다.

// 이 코드 예제는 JSON 마크업에서 Survey OMR을 생성하고 PDF로 저장하는 방법을 보여줍니다.
// 템플릿 마크업이 있는 JSON 파일 경로
string markupPath = @"C:\Files\OMR\SimpleSurvey.json";

// OMR 엔진 초기화
OmrEngine engine = new OmrEngine();

// 템플릿 생성
GenerationResult res = engine.GenerateJSONTemplate(markupPath);

// 로컬 디스크에 저장
res.SaveAsPdf(@"C:\Files\OMR\", "SimpleSurvey");
C#을 사용하여 JSON 마크업에서 PDF로 설문조사 만들기

C#을 사용하여 JSON 마크업에서 PDF로 설문조사를 만듭니다.

무료 라이선스 받기

임시 무료 라이선스 받기 평가 제한 없이 라이브러리를 사용해 볼 수 있습니다.

결론

이 기사에서는 JSON 마크업에서 OMR 설문조사 템플릿을 만들고 설문조사 이미지를 생성하는 방법을 배웠습니다. 또한 생성된 설문조사를 프로그래밍 방식으로 PDF 문서에 저장하는 방법도 살펴보았습니다. 또한 문서를 사용하여 .NET API용 Aspose.OMR에 대해 자세히 알아볼 수 있습니다. 모호한 부분이 있는 경우 포럼을 통해 언제든지 문의해 주십시오.

또한보십시오