我如何在c#Array.Sort(strParaValue);中对表和图进行排序? [英] How can i sort tables and figures in c#Array.Sort(strParaValue);
问题描述
大家好,
我曾对Word文档中出现的表格和图形进行排序.通常,表的引用会与表/图有所不同.根据引用,我需要对表格/数字值以及详细信息进行排序.
I worked to sort tables and figures which is occur in word document. Usually The table citations will differ the table/figure. as per the citation i need to sort the Table/figure values as well as the details.
对于内容分类,我使用了
For content sort i used
Array.Sort(strParaValue);
例如:在我的文档中,数字是这样发生的
Ex: In my document the figure is occurred like this
图:1 Apple
Fig:1 Apple
图:3 C#
Fig:2 钟声
我需要按字母顺序对本示例进行排序,包括附图.
I need to sort this Example alphabetically including the figure.
注意:可以在Word文档中使用标题吗?
Note: Is there any option to use the caption in word document?
Deepak G.的感谢与问候.
Thanks & Regards, Deepak G.
推荐答案
嗨.希望我能正确理解您的实现.您需要使用一个数组.似乎您正在尝试对单个字符串值进行排序.我建议尝试以下方法:
Hi. I hope I am understanding your implementation correctly. What you need to use is an array. It seems that you are trying to sort a single string value. I suggest trying the following approach:
string[] sarr = new string[3];
// Read your values into an array
// I had to hard code these to illustrate to you
// But you will read the values in from your data source/document
sarr[0] = "Fig:1 Apple";
sarr[1] = "Fig:3 C#";
sarr[2] = "Fig:2 Bell";
// You can then sort the array.
Array.Sort(sarr);
对数组排序时,输出如下:
When you sort the array, the output is as follows:
但是,要使其正常工作,您的数据必须已经在数组中才能排序.我希望这能回答您的问题.如果您还有其他问题,请告诉我.祝你好运!
But in order for this to work your data must already be in an array to be able to sort. I hope that this answers your question. Please let me know if you have any more questions. Good luck!
这篇关于我如何在c#Array.Sort(strParaValue);中对表和图进行排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!