[CODE]
// System.Windows.Forms - Добавить в ссылки
using System;
using System.IO;
using System.Collections.Generic;
using System.Windows.Forms;
using TFlex.Model;
namespace NewMacroNamespace
{
public class NewMacroClass
{
public static void NewMacro()
{
List<Document> lst = new List<Document>();
System.Windows.Forms.FolderBrowserDialog folderDialog = new System.Windows.Forms.FolderBrowserDialog();
string pathFolder = "";
if (folderDialog.ShowDialog() == DialogResult.OK)
{
pathFolder = folderDialog.SelectedPath;
}
DirectoryInfo dirInfo = new DirectoryInfo(pathFolder);
FileInfo[] files = dirInfo.GetFiles();
foreach (FileInfo file in files)
{
Document document = TFlex.Application.OpenDocument(file.FullName);
ExportToPDF ex = new ExportToPDF(document);
string path = document.FileName.ToString();
int slash = 0;
int pnt = 0;
for (int i = 0; i < path.ToCharArray().Length; i++)
{
if (path[i] == '\\')
slash = i;
}
slash++;
string res = path.Substring(slash);
for (int i = 0; i < res.ToCharArray().Length; i++)
{
if (res[i] == '.')
pnt = i;
}
res = res.Substring(0, pnt);
ex.Export(pathFolder + "\\" + res + ".pdf");
}
}
}
}
[/CODE]
// System.Windows.Forms - Добавить в ссылки
using System;
using System.IO;
using System.Collections.Generic;
using System.Windows.Forms;
using TFlex.Model;
namespace NewMacroNamespace
{
public class NewMacroClass
{
public static void NewMacro()
{
List<Document> lst = new List<Document>();
System.Windows.Forms.FolderBrowserDialog folderDialog = new System.Windows.Forms.FolderBrowserDialog();
string pathFolder = "";
if (folderDialog.ShowDialog() == DialogResult.OK)
{
pathFolder = folderDialog.SelectedPath;
}
DirectoryInfo dirInfo = new DirectoryInfo(pathFolder);
FileInfo[] files = dirInfo.GetFiles();
foreach (FileInfo file in files)
{
Document document = TFlex.Application.OpenDocument(file.FullName);
ExportToPDF ex = new ExportToPDF(document);
string path = document.FileName.ToString();
int slash = 0;
int pnt = 0;
for (int i = 0; i < path.ToCharArray().Length; i++)
{
if (path[i] == '\\')
slash = i;
}
slash++;
string res = path.Substring(slash);
for (int i = 0; i < res.ToCharArray().Length; i++)
{
if (res[i] == '.')
pnt = i;
}
res = res.Substring(0, pnt);
ex.Export(pathFolder + "\\" + res + ".pdf");
}
}
}
}
[/CODE]
Изменено: - 10.11.2017 10:41:12