Perhaps you need to create the style thenAt what here TextStyle? I need other.
Autodesk.AutoCAD.DatabaseServices.TableStyle.SetTextStyle(Autodesk.AutoCAD.DatabaseServices.ObjectId, string)
1: using System;
2: using System.Collections.Generic;
3: using System.Linq;
4: using System.Text;
5: [color=green]//Acad[/color]
6: using acad = Autodesk.AutoCAD.ApplicationServices.Application;
7: using Autodesk.AutoCAD.ApplicationServices;
8: using Autodesk.AutoCAD.DatabaseServices;
9: using Autodesk.AutoCAD.EditorInput;
10: using Autodesk.AutoCAD.Runtime;
11: using Autodesk.AutoCAD.Interop;
12:
13: namespace AcadBlockEditor
14: {
15: public class Class1
16: {
17: Document dwg;
18: Editor ed;
19: Database db;
20:
21: [CommandMethod("q1", CommandFlags.Modal)]
22: public void TestMethod()
23: {
24: dwg = acad.DocumentManager.MdiActiveDocument;
25: ed = dwg.Editor;
26: db = dwg.Database;
27: try
28: {
29: using (Transaction tr = dwg.TransactionManager.StartTransaction())
30: {
31: DBDictionary tsd = (DBDictionary) tr.GetObject(db.TableStyleDictionaryId, OpenMode.ForRead);
32: foreach (DBDictionaryEntry item in tsd)
33: {
34: [color=green]//ed.WriteMessage(string.Format("{0}{1}{0}", "\n", item.Key));[/color]
35: TableStyle ts = (TableStyle) tr.GetObject(item.Value, OpenMode.ForRead);
36: ed.WriteMessage(string.Format("{0}Table style name: '{1}'", "\n", ts.Name));
37: ed.WriteMessage(string.Format("{0}(TableStyle.CellStyles.IsReadOnly ='{1}')", "\n", ts.CellStyles.IsReadOnly));
38: [color=green]//Print all cell style names of table style[/color]
39: PrintCellStylesInfo(ts);
40: string stName = "MyStyle";[color=green]// name for my new cell style[/color]
41: lock (dwg.LockDocument())
42: {
43: ed.WriteMessage(string.Format("\nBefore modify: Cell Styles Count: {0}", ts.CellStyles.Count));
44: ts.UpgradeOpen();
45: ts.CellStyles.Add(stName);
46: ed.WriteMessage(string.Format("\nAfter modify: Cell Styles Count: {0}\n", ts.CellStyles.Count));
47: ts.SetCellClass(CellClass.Label, stName);
48: tr.Commit();
49: }
50: ed.WriteMessage(string.Format("{0}{1}{0}", "\nAfter modify:", new string('*', 30)));
51: [color=green]//Print all cell style names of table style[/color]
52: PrintCellStylesInfo(ts);
53: }
54: }
55: }
56: catch (System.Exception e)
57: {
58: ed.WriteMessage(e.Message);
59: }
60: }
61:
62: private void PrintCellStylesInfo(TableStyle ts)
63: {
64: foreach (var cs in ts.CellStyles)
65: {
66: ed.WriteMessage(string.Format("{0}CellStyle Type: '{1}'; CellStyle.ToString: {2}", "\n", cs.GetType(), cs.ToString()));
67: }
68: }
69: }
70: }
[CommandMethod("tts")]
public static void TableStyleTest()
{
Document doc = acadApp.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
Database db = doc.Database;
string tableStyleName = "Standard";
string textStyleName = "YourTextstyleName";
using (Transaction tr = db.TransactionManager.StartTransaction())
{
TextStyleTable tstyles = tr.GetObject
(db.TextStyleTableId, OpenMode.ForRead) as TextStyleTable;
if (!tstyles.Has(textStyleName)) return;
ObjectId newId = tstyles[textStyleName];
if (newId == ObjectId.Null) return;
DBDictionary dic = tr.GetObject(db.TableStyleDictionaryId, OpenMode.ForRead) as DBDictionary;
foreach (DictionaryEntry eDict in dic)
{
TableStyle tableStyle = tr.GetObject
((ObjectId)eDict.Value, OpenMode.ForRead) as TableStyle;
if (tableStyle.Name == tableStyleName)
{
tableStyle.UpgradeOpen();
foreach (RowType rt in Enum.GetValues(typeof(RowType)))
{
if (rt == RowType.UnknownRow) continue;
//if (rt = RowType.DataRow) yadayada;
ed.WriteMessage("\n" + rt.ToString() + " textstyle is "
+(tr.GetObject(tableStyle.TextStyle(rt),OpenMode.ForRead)
as TextStyleTableRecord).Name);
ObjectId idv = tableStyle.TextStyle(rt);
tableStyle.SetTextStyle(newId, (int)rt);
}
}
}
tr.Commit();
}
} // end TableStyleTest
Have you tried table.Cells[0,1].CellStyleOverrides
I don't know much about tables butThanks Bryco,
using interop = Autodesk.AutoCAD.Interop;
interop.AcadApplication Ap = (interop.AcadApplication)acadApp.AcadApplication;
object ob = Ap.ActiveDocument.ObjectIdToObject( tableStyle.ObjectId.OldId)
interop.Common.IAcadTableStyle ts = ob as interop.Common.IAcadTableStyle;
ts.CreateCellStyle("U12");
I don't know much about tables but
using interop = Autodesk.AutoCAD.Interop;
interop.AcadApplication Ap = (interop.AcadApplication)acadApp.AcadApplication;
object ob = Ap.ActiveDocument.ObjectIdToObject( tableStyle.ObjectId.OldId)
interop.Common.IAcadTableStyle ts = ob as interop.Common.IAcadTableStyle;
ts.CreateCellStyle("U12");
Have you tried table.Cells[0,1].CellStyleOverrides
Andrey,
I read your question to be about CellStyles too.
Perhaps it would help if you confirmed your exact question.
tb.Cells[i, j].Style = "Header";
[CommandMethod("tts")]
public static void TableStyleTest()
{
Document doc = acadApp.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
Database db = doc.Database;
string tableStyleName = "YourTableStyle";
using (Transaction tr = db.TransactionManager.StartTransaction())
{
TableStyle tableStyle;
DBDictionary dic = tr.GetObject(db.TableStyleDictionaryId, OpenMode.ForRead) as DBDictionary;
foreach (DictionaryEntry eDict in dic)
{
tableStyle = tr.GetObject
((ObjectId)eDict.Value, OpenMode.ForRead) as TableStyle;
if (tableStyle.Name == tableStyleName)
{
tableStyle.UpgradeOpen();
ArrayList ca = tableStyle.CellStyles;
interop.AcadApplication Ap = (interop.AcadApplication)acadApp.AcadApplication;
object ob = Ap.ActiveDocument.ObjectIdToObject( tableStyle.ObjectId.OldId);
interop.Common.IAcadTableStyle ts = ob as interop.Common.IAcadTableStyle;
TextStyleTable textstyletable=tr.GetObject
(db.TextStyleTableId,OpenMode.ForRead) as TextStyleTable;
object ob2 = Ap.ActiveDocument.ObjectIdToObject(textstyletable.ObjectId.OldId);
interop.Common.IAcadTextStyles tss = ob2 as interop.Common.IAcadTextStyles;
if(ca.Contains("U1")) ts.DeleteCellStyle("U1");
ts.CreateCellStyle("U1");
ts.SetCellClass("U1", 1);
if (ca.Contains("U2")) ts.DeleteCellStyle("U2");
ts.CreateCellStyle("U2");
ts.SetCellClass("U2", 2);
if (ca.Contains("U3")) ts.DeleteCellStyle("U3");
ts.CreateCellStyle("U3");
ts.SetCellClass("U3", 3);
ed.WriteMessage(tss.Item("User1").ObjectID.ToString());
if(textstyletable.Has("User1"))
ts.SetTextStyleId("U1", tss.Item("User1").ObjectID);
if (textstyletable.Has("User2"))
ts.SetTextStyleId("U2", tss.Item("User2").ObjectID);
if (textstyletable.Has("User3"))
ts.SetTextStyleId("U3", tss.Item("User3").ObjectID);
}
}
tr.Commit();
}
} // end TableStyleTest
With this one can add a cellstyle, delete a cellstyle, set the textstyle for a cellstyle.
It requires you to add some textstyles and a tablestyle
1) Apparantly it is impossible (whatever you do don't actually try it)
2) It probably is no use to the OP , as it is in no way what he wanted.
3) Who wants to use interop anyway.Code: [Select][CommandMethod("tts")]
public static void TableStyleTest()
{
Document doc = acadApp.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
Database db = doc.Database;
string tableStyleName = "YourTableStyle";
using (Transaction tr = db.TransactionManager.StartTransaction())
{
TableStyle tableStyle;
DBDictionary dic = tr.GetObject(db.TableStyleDictionaryId, OpenMode.ForRead) as DBDictionary;
foreach (DictionaryEntry eDict in dic)
{
tableStyle = tr.GetObject
((ObjectId)eDict.Value, OpenMode.ForRead) as TableStyle;
if (tableStyle.Name == tableStyleName)
{
tableStyle.UpgradeOpen();
ArrayList ca = tableStyle.CellStyles;
interop.AcadApplication Ap = (interop.AcadApplication)acadApp.AcadApplication;
object ob = Ap.ActiveDocument.ObjectIdToObject( tableStyle.ObjectId.OldId);
interop.Common.IAcadTableStyle ts = ob as interop.Common.IAcadTableStyle;
TextStyleTable textstyletable=tr.GetObject
(db.TextStyleTableId,OpenMode.ForRead) as TextStyleTable;
object ob2 = Ap.ActiveDocument.ObjectIdToObject(textstyletable.ObjectId.OldId);
interop.Common.IAcadTextStyles tss = ob2 as interop.Common.IAcadTextStyles;
if(ca.Contains("U1")) ts.DeleteCellStyle("U1");
ts.CreateCellStyle("U1");
ts.SetCellClass("U1", 1);
if (ca.Contains("U2")) ts.DeleteCellStyle("U2");
ts.CreateCellStyle("U2");
ts.SetCellClass("U2", 2);
if (ca.Contains("U3")) ts.DeleteCellStyle("U3");
ts.CreateCellStyle("U3");
ts.SetCellClass("U3", 3);
ed.WriteMessage(tss.Item("User1").ObjectID.ToString());
if(textstyletable.Has("User1"))
ts.SetTextStyleId("U1", tss.Item("User1").ObjectID);
if (textstyletable.Has("User2"))
ts.SetTextStyleId("U2", tss.Item("User2").ObjectID);
if (textstyletable.Has("User3"))
ts.SetTextStyleId("U3", tss.Item("User3").ObjectID);
}
}
tr.Commit();
}
} // end TableStyleTest
just tried (have been a long time, since I did something for a table object)... using a Kean existing sample in his site, I can modify the cells with an existing cell type.
http://through-the-interface.typepad.com/through_the_interface/2008/11/creating-a-cust.htmlCode: [Select]tb.Cells[i, j].Style = "Header";
Have not tried to add a new one, but guess that has to be based on an existing one and change it from there...
object ob = Ap.ActiveDocument.ObjectIdToObject( tableStyle.ObjectId.OldId);
interop.Common.IAcadTableStyle ts = ob as interop.Common.IAcadTableStyle;
can now be condensed to: interop.Common.IAcadTableStyle ts = tableStyle.AcadObject as interop.Common.IAcadTableStyle;
The reason he had used the OldId to get the COM object, is because .NET & COM use 2 different ObjectId's.
Add the references you need. I have both Autodac and AxdbLib.nice solution Bryco, thanks!.... tried here via normal .net and appears to no way.
Your on your own now, I think Fox News is hiring though. ???? woot?
So, what version are you trying to use this with?I use AutoCAD 2009 x64 SP3 Enu.
The reason he had used the OldId to get the COM object, is because .NET & COM use 2 different ObjectId's.
Add the references you need. I have both Autodac and AxdbLib.Thank you. My project has some references, and I can't add new reference on AxdbLib.
Your on your own now, I think Fox News is hiring though.I translate this suggestion, but I can't understand it.
You do not need to reference the Autodesk.AutoCAD.Interop.Common.Thank you!
You need to reference the axdb17enu.tlb (the last one shown in the Browse dialog). You should be able to see this in the COM listings as "AutoCAD/ObjectDBX Common 17.0 Type Library". With this, and the AutoCAD reference you already have, these are the only 2 required to access most, in not all, AutoCAD Interop objects, methods & properties.
The OldId is used when combining the use of .NET and COM objects, just as Bryco showed for getting a .NET object's COM counterpart. That's about the extent of my ability to explain this. Perhaps some one else can do a better or more thorough job.
Perhaps if we posted a zipped 'Solution' of all files for others to test some of the problems could be resolved earlier.
Sometimes it takes longer to find out what is missing than it does to resolve an actual problem .... and not all of us can make time to spare to become involved.
What happens if you use these references ??
the ObjectARX 2009 Reference:
At first I did too. You can see result on my Reply #24 on: July 25, 2010, 03:41:47 pm for Windows 7 x64 (I showed the screen).
For Windows XP x86 other screen:
Perhaps you could remove ALL the AutoCad based references and re-reference them :)
Have the rules changed again ??
Which version and Operating System are you actually trying to build on
Perhaps you could remove ALL the AutoCad based references and re-reference themI tried to do it.
Perhaps you could remove ALL the AutoCad based references and re-reference them :)
If I delete AutoCAD reference, then I get result which I show on my Reply #17 on: July 25, 2010, 12:57:30 pm.
QuoteHave the rules changed again ??
Which version and Operating System are you actually trying to build on
I have Windows 7 x64 Ultimate and AutoCAD 2009 x64 SP3 Enu on my home.
I have Windows XP x86 SP3 Professional and AutoCAD 2009 x86 SP3 Enu on my office (work).
Some my users use Windows 7 x64, and some - Windows XP x86 SP3 Professional. Most my users (99%) use AutoCAD 2009.
QuotePerhaps you could remove ALL the AutoCad based references and re-reference themI tried to do it.
great. How about resolving ONE issue at a time.and
Choose one build and get it correct.
Then resolve the other build.
Perhaps you should try againMost important variant - Windows XP x86 SP3 and AutoCAD 2009 x86.
... and tell us which build you are working on.
The video was a bit unclear for me.Yes!!!!! ))))))
I just looked at the contents of Autodesk.AutoCAD.Interop.Common for 2009
There is a public interface IAcadTableStyle : IAcadObject
and a public interface IAcadTableStyle2 : IAcadTableStyle
ONLY the IAcadTableStyle2 has
void DeleteCellStyle(string bstrCellStyle);
void CreateCellStyle(string bstrCellStyle);
I can't test this, but perhaps try
// interop.Common.IAcadTableStyle ts = ob as interop.Common.IAcadTableStyle;
interop.Common.IAcadTableStyle2 ts = ob as interop.Common.IAcadTableStyle2;
With this one can add a cellstyle, delete a cellstyle, set the textstyle for a cellstyle.
It requires you to add some textstyles and a tablestyle
1) Apparantly it is impossible (whatever you do don't actually try it)
2) It probably is no use to the OP , as it is in no way what he wanted.
3) Who wants to use interop anyway.Code: [Select][CommandMethod("tts")]
public static void TableStyleTest()
{
Document doc = acadApp.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
Database db = doc.Database;
string tableStyleName = "YourTableStyle";
using (Transaction tr = db.TransactionManager.StartTransaction())
{
TableStyle tableStyle;
DBDictionary dic = tr.GetObject(db.TableStyleDictionaryId, OpenMode.ForRead) as DBDictionary;
foreach (DictionaryEntry eDict in dic)
{
tableStyle = tr.GetObject
((ObjectId)eDict.Value, OpenMode.ForRead) as TableStyle;
if (tableStyle.Name == tableStyleName)
{
tableStyle.UpgradeOpen();
ArrayList ca = tableStyle.CellStyles;
interop.AcadApplication Ap = (interop.AcadApplication)acadApp.AcadApplication;
object ob = Ap.ActiveDocument.ObjectIdToObject( tableStyle.ObjectId.OldId);
interop.Common.IAcadTableStyle ts = ob as interop.Common.IAcadTableStyle;
TextStyleTable textstyletable=tr.GetObject
(db.TextStyleTableId,OpenMode.ForRead) as TextStyleTable;
object ob2 = Ap.ActiveDocument.ObjectIdToObject(textstyletable.ObjectId.OldId);
interop.Common.IAcadTextStyles tss = ob2 as interop.Common.IAcadTextStyles;
if(ca.Contains("U1")) ts.DeleteCellStyle("U1");
ts.CreateCellStyle("U1");
ts.SetCellClass("U1", 1);
if (ca.Contains("U2")) ts.DeleteCellStyle("U2");
ts.CreateCellStyle("U2");
ts.SetCellClass("U2", 2);
if (ca.Contains("U3")) ts.DeleteCellStyle("U3");
ts.CreateCellStyle("U3");
ts.SetCellClass("U3", 3);
ed.WriteMessage(tss.Item("User1").ObjectID.ToString());
if(textstyletable.Has("User1"))
ts.SetTextStyleId("U1", tss.Item("User1").ObjectID);
if (textstyletable.Has("User2"))
ts.SetTextStyleId("U2", tss.Item("User2").ObjectID);
if (textstyletable.Has("User3"))
ts.SetTextStyleId("U3", tss.Item("User3").ObjectID);
}
}
tr.Commit();
}
} // end TableStyleTest
Problem solved, now I'll ask my OT question.this (http://www.techsmith.com/screen-capture.asp)
What software was used to annotate Kerry's and Hwd's pictures. Can never be enough cool tools.
Problem solved, now I'll ask my OT question.this (http://www.techsmith.com/screen-capture.asp)
What software was used to annotate Kerry's and Hwd's pictures. Can never be enough cool tools.
The video was a bit unclear for me.
I just looked at the contents of Autodesk.AutoCAD.Interop.Common for 2009
There is a public interface IAcadTableStyle : IAcadObject
and a public interface IAcadTableStyle2 : IAcadTableStyle
ONLY the IAcadTableStyle2 has
void DeleteCellStyle(string bstrCellStyle);
void CreateCellStyle(string bstrCellStyle);
I can't test this, but perhaps try
// interop.Common.IAcadTableStyle ts = ob as interop.Common.IAcadTableStyle;
interop.Common.IAcadTableStyle2 ts = ob as interop.Common.IAcadTableStyle2;
...they version them to add the 'new' features of the underlying objects they want to expose...
Please Donate to theSwamp.org (http://www.theswamp.org/donate.html)
I don't know of anyone at theSwamp who has been deceived.I am afraid to enter of my confidential data (data of my card) on page www.paypal.com
using System;
using System.Runtime.InteropServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.EditorInput;
using acadApp = Autodesk.AutoCAD.ApplicationServices.Application;
[assembly: CommandClass(typeof(CellStyles.MyCommands))]
namespace CellStyles
{
public class MyCommands
{
[CommandMethod("q1", CommandFlags.Modal)]
public void TestMethod()
{
Document doc = acadApp.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
Database db = doc.Database;
using (Transaction tr = doc.TransactionManager.StartTransaction())
{
DBDictionary tsd = (DBDictionary) tr.GetObject(db.TableStyleDictionaryId, OpenMode.ForRead);
foreach (DBDictionaryEntry item in tsd)
{
TableStyle ts = (TableStyle)tr.GetObject(item.Value, OpenMode.ForRead);
ed.WriteMessage(string.Format("{0}Table style name: '{1}'", Environment.NewLine, ts.Name));
ed.WriteMessage(string.Format("{0}(TableStyle.CellStyles.IsReadOnly ='{1}')",
Environment.NewLine, ts.CellStyles.IsReadOnly));
//Print all cell style names of table style
PrintCellStylesInfo(ts);
string stName = "MyStyle";// name for my new cell style
ed.WriteMessage(string.Format("{0}Before modify: Cell Styles Count: {1}",
Environment.NewLine, ts.CellStyles.Count));
ts.UpgradeOpen();
AcDbTable.createCellStyle(ts.UnmanagedObject, stName);
ed.WriteMessage(string.Format("{0}After modify: Cell Styles Count: {1}{0}",
Environment.NewLine, ts.CellStyles.Count));
ts.SetCellClass(CellClass.Label, stName);
ed.WriteMessage(string.Format("{0}{1}{0}", "\nAfter modify:", new string('*', 30)));
//Print all cell style names of table style
PrintCellStylesInfo(ts);
}
tr.Commit();
}
}
private void PrintCellStylesInfo(TableStyle ts)
{
foreach (var cs in ts.CellStyles)
{
Document doc = acadApp.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
ed.WriteMessage(string.Format("{0}CellStyle Type: '{1}'; CellStyle.ToString: {2}",
Environment.NewLine, cs.GetType(), cs.ToString()));
}
}
}
public static class AcDbTable
{
// Acad::ErrorStatus createCellStyle(const ACHAR* pszCellStyle);
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("acdb18.dll", CallingConvention = CallingConvention.ThisCall, CharSet = CharSet.Unicode,
EntryPoint = "?createCellStyle@AcDbTableStyle@@QEAA?AW4ErrorStatus@Acad@@PEB_W@Z")]
public static extern ErrorStatus createCellStyle(IntPtr tableStyle, string name);
}
}
2010 64bit btw...Thank you.
public static class AcadTableStyle
{
/// <summary>
/// Extended method for TableStyle class.
/// </summary>
/// <param name="tableStyle">TableStyle object (source)</param>
/// <param name="cellStyleName">Cell Style name</param>
public static void AddCellStyle(this TableStyle tableStyle, string cellStyleName)
{
Document dwg = acad.DocumentManager.MdiActiveDocument;
Editor ed = dwg.Editor;
try
{
if (tableStyle.CellStyles.Contains(cellStyleName)) throw new System.Exception("TableStyle has CellStyle with it name already!");
TableStyle ts = tableStyle;
IAcadTableStyle2 ts2 = (IAcadTableStyle2)((AcadApplication)acad.AcadApplication).ActiveDocument.ObjectIdToObject((int)ts.ObjectId.OldIdPtr);
using (Transaction t = dwg.TransactionManager.StartTransaction())
{
lock (dwg.LockDocument())
{
ts.UpgradeOpen();
ts2.CreateCellStyle(cellStyleName);
t.Commit();
}
}
}
catch (System.Exception e)
{
ed.WriteMessage(string.Format("{0}{1}{0}", "\n", e.Message));
}
}
}
? I do not confirm, but I ask.using System;
using System.Runtime.InteropServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.EditorInput;
using acadApp = Autodesk.AutoCAD.ApplicationServices.Application;
[assembly: CommandClass(typeof(CellStyles.MyCommands))]
namespace CellStyles
{
public class MyCommands
{
[CommandMethod("q1", CommandFlags.Modal)]
public void TestMethod()
{
Document doc = acadApp.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
Database db = doc.Database;
using (Transaction tr = doc.TransactionManager.StartTransaction())
{
DBDictionary tsd = (DBDictionary)tr.GetObject(db.TableStyleDictionaryId, OpenMode.ForRead);
foreach (DBDictionaryEntry item in tsd)
{
TableStyle ts = (TableStyle)tr.GetObject(item.Value, OpenMode.ForRead);
ed.WriteMessage(string.Format("{0}Table style name: '{1}'", Environment.NewLine, ts.Name));
ed.WriteMessage(string.Format("{0}(TableStyle.CellStyles.IsReadOnly ='{1}')",
Environment.NewLine, ts.CellStyles.IsReadOnly));
//Print all cell style names of table style
PrintCellStylesInfo(ts);
string stName = "MyStyle";// name for my new cell style
ed.WriteMessage(string.Format("{0}Before modify: Cell Styles Count: {1}",
Environment.NewLine, ts.CellStyles.Count));
ts.UpgradeOpen();
[color=red]ts.AddCellStyle(stName);[/color][color=green]//Extension method[/color]
//AcDbTable.createCellStyle(ts.UnmanagedObject, stName);
ed.WriteMessage(string.Format("{0}After modify: Cell Styles Count: {1}{0}",
Environment.NewLine, ts.CellStyles.Count));
ts.SetCellClass(CellClass.Label, stName);
ed.WriteMessage(string.Format("{0}{1}{0}", "\nAfter modify:", new string('*', 30)));
//Print all cell style names of table style
PrintCellStylesInfo(ts);
}
tr.Commit();
}
}
private void PrintCellStylesInfo(TableStyle ts)
{
foreach (var cs in ts.CellStyles)
{
Document doc = acadApp.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
ed.WriteMessage(string.Format("{0}CellStyle Type: '{1}'; CellStyle.ToString: {2}",
Environment.NewLine, cs.GetType(), cs.ToString()));
}
}
}
}
Maybe, but you're still using COM and that's version dependent as well. Personally, I would use the DLLImport option over COM. Alexander Rivilis had a good implementation for multiple versions shown here (http://www.theswamp.org/index.php?topic=10606.msg134917#msg134917).Thank you!