Aspose.cad .net (23.7.0.0)dwg块的文字内容怎么修改。

我找到块中的cadtext 实例后直接赋值 cadText.DefaultValue=“新值”,导出成pdf后文字内容没有变化,请问怎么修改cadtext 实例的值。
修改block.zip (283.2 KB)

@hardp,
你能测试一下这个例子吗:

using (CadImage cadImage = (CadImage)Aspose.CAD.Image.Load(fileName, new LoadOptions { SpecifiedEncoding = CodePages.SimpChinese }))
{
	CadRasterizationOptions options = new CadRasterizationOptions();
	options.PageSize = new SizeF(2500, 2500);

	CadText textEntity = FindTextEntity(cadImage.BlockEntities, cadImage.Entities, "BD20306");
	textEntity.DefaultValue = "new value";

	PdfOptions pdfOptions = new PdfOptions();
	pdfOptions.VectorRasterizationOptions = options;

	cadImage.Save(outPath, pdfOptions);
}

private CadText FindTextEntity(CadBlockDictionary blockDictionary, IEnumerable<CadEntityBase> entities, string textValue)
{
	foreach (CadEntityBase eb in entities)
	{
		if (eb.TypeName == CadEntityTypeName.TEXT)
		{
			CadText cadText = (CadText)eb;

			if (cadText.DefaultValue == textValue)
			{
				return cadText;
			}
		}

		// for embedded inserts
		if (eb.TypeName == CadEntityTypeName.INSERT)
		{
			CadInsertObject insert = (CadInsertObject)eb;
			CadBlockEntity block = blockDictionary[insert.Name];

			CadText found = FindTextEntity(blockDictionary, block.Entities, textValue);

			if (found != null)
			{
				return found;
			}
		}
	}

	return null;
}