我在将Crystal Reports导出到excel文件时遇到问题.
我尝试了导出Excel数据和导出为excel文件的两个选项.当我将Crystal Report导出为excel文件时,我无法对excel文件中的任何字段进行排序.当我将报告导出为excel数据时,当我在Excel中打开时,标题真的搞砸了.前三个标题显示在所有列的END处 - 这对我没有任何意义.
有人知道如何在Visual Studio中更改导出选项吗?我在Visual Studio上使用Crystal Reports,并且不知道如何更改任何这些选项.
我有以下内容:
PMRCutoffDate.Value = ReportCalc.Cutoff_Date.ToString("MM/dd/yyyy");
PMRDate.Value = DateTime.Now.ToString("MM/dd/yyyy");
Run Code Online (Sandbox Code Playgroud)
我希望日期显示为:03/05/2010,而非2010年3月5日或2010年5月5日或2010年5月3日
但是,我的程序STILL错误地显示日期(2010年3月10日).
关于什么是错的任何想法?
我试图从以下代码获得以下内容:[今天的日期] ___ [textfilename] .txt:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ConsoleApplication29
{
class Program
{
static void Main(string[] args)
{
WriteToFile();
}
static void WriteToFile()
{
StreamWriter sw;
sw = File.CreateText("c:\\testtext.txt");
sw.WriteLine("this is just a test");
sw.Close();
Console.WriteLine("File created successfully");
}
}
}
Run Code Online (Sandbox Code Playgroud)
我试过投入,DateTime.Now.ToString()但我无法组合字符串.
有谁能够帮我?我希望FRONT中的日期是我正在创建的新文本文件的标题.
我试图获取看起来像这样的文件名:
MAX_1.01.01.03.pdf看起来像Max_1010103.pdf.
目前我有这个代码:
public void Sanitizer(List<string> paths)
{
string regPattern = (@"[~#&!%+{}]+");
string replacement = " ";
Regex regExPattern = new Regex(regPattern);
Regex regExPattern2 = new Regex(@"\s{2,}");
Regex regExPattern3 = new Regex(@"\.(?=.*\.)");
string replace = "";
var filesCount = new Dictionary<string, int>();
dataGridView1.Rows.Clear();
try
{
foreach (string files2 in paths)
{
string filenameOnly = System.IO.Path.GetFileName(files2);
string pathOnly = System.IO.Path.GetDirectoryName(files2);
string sanitizedFileName = regExPattern.Replace(filenameOnly, replacement);
sanitizedFileName = regExPattern2.Replace(sanitizedFileName, replacement);
string sanitized = System.IO.Path.Combine(pathOnly, sanitizedFileName);
if (!System.IO.File.Exists(sanitized))
{
DataGridViewRow clean = new …Run Code Online (Sandbox Code Playgroud) 我有以下代码:[谢谢Mike Rosenblum!]
使用系统; 使用System.Collections.Generic; 使用System.Linq; 使用System.Text; 使用Microsoft.Office.Interop.Excel; 使用System.Runtime.InteropServices;
namespace ConsoleApplication17 {class Program {
static void Main(string[] args) {
//public void PrintMyExcelFile()
//{
Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
// Open the Workbook:
Microsoft.Office.Interop.Excel.Workbook wb = excelApp.Workbooks.Open(
@"C:\hello.xls",
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing,Type.Missing,Type.Missing);
// Get the first worksheet.
// (Excel uses base 1 indexing, not base 0.)
Microsoft.Office.Interop.Excel.Worksheet ws = (Microsoft.Office.Interop.Excel.Worksheet)wb.Worksheets[1];
// Print out 1 copy to the default printer:
ws.PrintOut(
Type.Missing, Type.Missing, Type.Missing, Type.Missing, …Run Code Online (Sandbox Code Playgroud) 我有以下代码:
foreach (string p in dirs)
{
string path = p;
string lastAccessTime = File.GetLastAccessTime(path).ToString();
bool DirFile = File.Exists(path);
FileInfo fInf = new FileInfo(path);
DateTime lastWriteTime = File.GetLastWriteTime(p);
dirFiles.Add(p + "|" + lastAccessTime.ToString() + "|" + DirFile.ToString() + "|" + lastWriteTime.ToString() + "|" + fInf.Length.ToString());
}
Run Code Online (Sandbox Code Playgroud)
我有一个fInf.Length.ToString(),我想用kbs来衡量输出.有关如何实现这一目标的任何想法?例如,我不想将2048作为文件大小,而是想得到2Kb.
在此先感谢您的帮助
我必须创建一个可以钻入特定驱动器的应用程序,读取所有文件名并用下划线替换非法SharePoint字符.我指的非法字符是: ~ # % & * {} / \ | : <> ? - ""
有人可以提供代码链接或代码本身如何做到这一点?我对C#非常陌生,需要我能得到的所有帮助.我已经研究了递归钻取驱动器的代码,但我不知道如何将字符替换和递归循环放在一起.请帮忙!
我有一个 Excel 工作表,并试图找出是否有办法抓取文本黑白斜杠。
例如:
[在单元格 B9 中] R:\FINANCE-Asia\Q1Report.html
我想拉出:FINANCE-ASIA 并将其放入单元格 C9 中。
有人知道这个的公式是什么吗?
我有一个报告,其中的字段来自从SQL服务器提取的数据.我有一个完整的字段,我已添加到报告中...但是我有一个有趣的难题 - 我希望有人有一个我可以使用的公式.
我的三个列不需要求和...但是我的项目要求告诉我只是从报告的最后一行拉出最后一个数字并将其放在总行中.为了更好地澄清:
1999 0.1% 0.2% 0.3%
2001 -2% 0.3% 3.4%
Run Code Online (Sandbox Code Playgroud)
基本上,在总计领域,我将从2001年开始提取值,因为它是最后一个报告行.在我的总行中,我希望显示-2%,0.3%和3.4%(因为这些是最后一行的值).基本上,我只想拉最后一个报告行的数据(不是总数).
任何人都有一个我可以使用的公式吗?