Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Creating multiple row Text entity corrupts output file #472

Open
schebotar opened this issue Aug 4, 2023 · 3 comments
Open

Creating multiple row Text entity corrupts output file #472

schebotar opened this issue Aug 4, 2023 · 3 comments
Labels

Comments

@schebotar
Copy link

Hello
Affected code is

using netDxf;
using netDxf.Entities;

var invalid = new DxfDocument();
var text = new Text("Multiply\nrows\ntext");
invalid.Entities.Add(text);
invalid.Save("invalid.dxf");

var valid = new DxfDocument();
text = new Text("One row text");
valid.Entities.Add(text);
valid.Save("valid.dxf");

The first one should throw an Argument exception because text entity does not support multiple rows.

@haplokuon
Copy link
Owner

A Text entity only can hold a single line of text and "\n" is not a valid character. Use the MText entity instead, and read the documentation to know how to format the text string. "\n" is not the new paragraph character.

@schebotar
Copy link
Author

schebotar commented Aug 4, 2023 via email

@haplokuon
Copy link
Owner

haplokuon commented Aug 4, 2023

You should ask Autodesk for that, no way I am gonna test what characters AutoCAD likes and what doesn't, because I do not know. The DXF documentation just says that code 1 holds a string.

Never try to force a new line when defining strings in any place or you will brake the line in the code-value pair in the DXF.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants