Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / ASP.NET [игнор отключен] [закрыт для гостей] / Вопрос по созданию word файла / 7 сообщений из 7, страница 1 из 1
01.12.2006, 11:05
    #34169590
RasimS
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Вопрос по созданию word файла
Добрый день! Есть такая проблемка, создал вордовский файл, а как в него вставить таблицу. Для pdf есть библиотека. Как быть с word файлом?
...
Рейтинг: 0 / 0
01.12.2006, 11:14
    #34169619
timur999
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Вопрос по созданию word файла
И для Word есть библиотека
...
Рейтинг: 0 / 0
01.12.2006, 11:23
    #34169657
RasimS
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Вопрос по созданию word файла
timur999И для Word есть библиотека
А как она называется и где ее можно скачать?
...
Рейтинг: 0 / 0
01.12.2006, 11:34
    #34169695
timur999
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Вопрос по созданию word файла
Не надо ничего качать
Вот:
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
187.
188.
189.
190.
191.
192.
193.
194.
195.
196.
197.
198.
199.
200.
201.
202.
203.
204.
205.
206.
207.
208.
209.
210.
211.
212.
213.
214.
215.
216.
217.
218.
219.
220.
221.
222.
223.
224.
225.
226.
227.
228.
229.
230.
231.
232.
233.
234.
235.
236.
237.
238.
239.
240.
241.
242.
243.
244.
245.
246.
247.
248.
249.
250.
251.
252.
253.
254.
255.
256.
257.
258.
259.
using System;
using System.Runtime.InteropServices;
using System.Reflection;

namespace ClassWord
{
	namespace Word
	{
		public enum WdFindWrap: int
		{
			wdFindAsk =  2 ,
			wdFindContinue =  1 ,
			wdFindStop =  0 
		}

		public enum WdReplace: int
		{
			wdReplaceAll =  2 ,
			wdReplaceNone =  0 ,
			wdReplaceOne =  1 
		}

		/// <summary>
		/// Summary description for Application
		/// </summary>
		public class Application
		{
			private object application;

			public bool Visible
			{
				get
				{
					return Convert.ToBoolean(application.GetType().InvokeMember("Visible", BindingFlags.GetProperty, null, application, null));
				}
				set
				{
					application.GetType().InvokeMember("Visible", BindingFlags.SetProperty, null, application, new object[] {value});
				}
			}

			public void Quit()
			{
				application.GetType().InvokeMember("Quit", BindingFlags.InvokeMethod, null, application, null);
				Marshal.ReleaseComObject(application);
				GC.GetTotalMemory(true);
			}

			public Documents Documents
			{
				get
				{
					return new Documents(application.GetType().InvokeMember("Documents", BindingFlags.GetProperty, null, application, null));
				}
			}

			public Selection Selection
			{
				get
				{
					return new Selection(application.GetType().InvokeMember("Selection", BindingFlags.GetProperty, null, application, null));
				}
			}

			public Application()
			{
				string sAppProgID = "Word.Application";
				Type tWordObj = Type.GetTypeFromProgID(sAppProgID);
				application = Activator.CreateInstance(tWordObj);
			}
		}

		/// <summary>
		/// Summary description for Documents
		/// </summary>
		public class Documents
		{
			private object documents;

			public Document Add()
			{
				return new Document(documents.GetType().InvokeMember("Add", BindingFlags.InvokeMethod, null, documents, null));
			}

			public Document Open(string fileName)
			{
				return new Document(documents.GetType().InvokeMember("Open", BindingFlags.InvokeMethod, null, documents, new object[] {fileName}));
			}

			public void Close()
			{
				documents.GetType().InvokeMember("Close", BindingFlags.InvokeMethod, null, documents, null);
				Marshal.ReleaseComObject(documents);
				GC.GetTotalMemory(true);
			}

			public Documents(object _documents)
			{
				documents = _documents;
			}
		}

		/// <summary>
		/// Summary description for Document
		/// </summary>
		public class Document
		{
			private object document;

			public void Save()
			{
				document.GetType().InvokeMember("SaveAs", BindingFlags.InvokeMethod, null, document, null);
			}

			public void SaveAs(string fileName)
			{
				document.GetType().InvokeMember("SaveAs", BindingFlags.InvokeMethod, null, document, new object[]{fileName});
			}

			public void Close()
			{
				document.GetType().InvokeMember("Close", BindingFlags.InvokeMethod, null, document, null);
				Marshal.ReleaseComObject(document);
				GC.GetTotalMemory(true);
			}

			public Document(object _document)
			{
				document = _document;
			}
		}

		/// <summary>
		/// Summary description for Selection
		/// </summary>
		public class Selection
		{
			private object selection;

			public Find Find
			{
				get
				{
					return new Find(selection.GetType().InvokeMember("Find", BindingFlags.GetProperty, null, selection, null));
				}
			}

			public Selection(object _selection)
			{
				selection = _selection;
			}
		}

		/// <summary>
		/// Summary description for Find
		/// </summary>
		public class Find
		{
			private object find;

			public void Execute(object FindText, object MatchCase, object MatchWholeWord, object MatchWildcards, object MatchSoundsLike, object MatchAllWordForms, object Forward, WdFindWrap Wrap, object Format, object ReplaceWith, WdReplace Replace, object MatchKashida, object MatchDiacritics, object MatchAlefHamza, object MatchControl)
			{
				object[] args = new object[ 15 ] {FindText, MatchCase, MatchWholeWord, MatchWildcards, MatchSoundsLike, MatchAllWordForms, Forward, Wrap, Format, ReplaceWith, Replace, MatchKashida, MatchDiacritics, MatchAlefHamza, MatchControl};
				find.GetType().InvokeMember("Execute", BindingFlags.InvokeMethod, null, find, args);
			}

			public Font Font
			{
				get
				{
					return new Font(find.GetType().InvokeMember("Font", BindingFlags.GetProperty, null, find, null));
				}
			}

			public Replacement Replacement
			{
				get
				{
					return new Replacement(find.GetType().InvokeMember("Replacement", BindingFlags.GetProperty, null, find, null));
				}
			}

			public Find(object _find)
			{
				find = _find;
			}
		}

		/// <summary>
		/// Summary description for Replacement
		/// </summary>
		public class Replacement
		{
			private object replacement;

			public Font Font
			{
				get
				{
					return new Font(replacement.GetType().InvokeMember("Font", BindingFlags.GetProperty, null, replacement, null));
				}
			}

			public Replacement(object _replacement)
			{
				replacement = _replacement;
			}
		}

		/// <summary>
		/// Summary description for Font
		/// </summary>
		public class Font
		{
			object font;

			public string Name
			{
				get
				{
					return Convert.ToString(font.GetType().InvokeMember("Name", BindingFlags.GetProperty, null, font, null));
				}
				set
				{
					font.GetType().InvokeMember("Name", BindingFlags.SetProperty, null, font, new object[] {value});
				}
			}

			public bool Bold
			{
				get
				{
					return Convert.ToBoolean(font.GetType().InvokeMember("Bold", BindingFlags.GetProperty, null, font, null));
				}
				set
				{
					font.GetType().InvokeMember("Bold", BindingFlags.SetProperty, null, font, new object[] {value});
				}
			}

			public bool Italic
			{
				get
				{
					return Convert.ToBoolean(font.GetType().InvokeMember("Italic", BindingFlags.GetProperty, null, font, null));
				}
				set
				{
					font.GetType().InvokeMember("Italic", BindingFlags.SetProperty, null, font, new object[] {value});
				}
			}

			public Font(object _font)
			{
				font = _font;
			}
		}
	}
}
...
Рейтинг: 0 / 0
01.12.2006, 11:49
    #34169769
RasimS
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Вопрос по созданию word файла
спасиб
...
Рейтинг: 0 / 0
01.12.2006, 11:59
    #34169813
Scif
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Вопрос по созданию word файла
to timur999:
на сколько я понимаю в таком случае на машине - генераторе должен быть установлен Ворд.
Приемлимо ли это для ВЕБ-приложений?
...
Рейтинг: 0 / 0
01.12.2006, 12:34
    #34170004
timur999
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Вопрос по созданию word файла
Тут что заказывали, то и кушаем. Нужен Word, значит на сервер надо его установить. Вся фишка в том, что при позднем связывании версия Word не критична. Вот и все
...
Рейтинг: 0 / 0
Форумы / ASP.NET [игнор отключен] [закрыт для гостей] / Вопрос по созданию word файла / 7 сообщений из 7, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]